:root {
  --bg: #17151a;
  --panel: #1f1c23;
  --panel-2: #29252e;
  --line: #34303b;
  --text: #ece8e1;
  --muted: #9a948e;
  --orange: #f2994a;
  --green: #6fcf97;
  --red: #eb5757;
  --yellow: #f2c94c;
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: Consolas, 'Cascadia Mono', 'SFMono-Regular', Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--orange); text-underline-offset: 3px; }
a:hover { color: #ffb36b; }
img { max-width: 100%; display: block; }
main { flex: 1; width: 100%; max-width: 920px; margin: 0 auto; padding: 40px 20px 72px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 10px; font-weight: 700; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.3rem; margin-top: 44px; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 14px; }
figure { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* header */
.site-header { border-bottom: 1px solid var(--line); }
.nav { max-width: 920px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; text-decoration: none; }
.brand:hover { color: var(--text); }
.brand img { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; }
.nav-links { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; }
.nav-links a { color: var(--muted); text-decoration: none; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a.active { text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 2px; }
.nav-links a.dev-link { color: var(--yellow); }
.nav-user { display: flex; align-items: center; gap: 10px; }
.nav-user img { width: 28px; height: 28px; border-radius: 50%; }
.nav-user form { margin: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 6px; border: 1px solid var(--orange);
  background: var(--orange); color: #1b1208; font: 600 0.95rem var(--font);
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: #ffad61; color: #1b1208; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary, .btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.secondary:hover, .btn.ghost:hover { border-color: var(--muted); color: var(--text); background: transparent; }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn.danger:hover:not(:disabled) { background: var(--red); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 0.85rem; }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn.discord:hover { background: #6d78f5; }

/* home */
.intro { display: flex; gap: 28px; align-items: flex-start; }
.intro .cat { width: 120px; flex-shrink: 0; }
.intro .cat img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; }
.intro .cat figcaption { font-size: 0.75rem; color: var(--muted); margin-top: 4px; text-align: center; }
.intro h1 { font-size: 2.3rem; }
.intro p { font-size: 1.08rem; max-width: 620px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.status { font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: 1px; }
.dot.on { background: var(--green); }
.dot.off { background: var(--red); }
.example { margin: 36px 0 8px; }
.example img { border-radius: 8px; border: 1px solid var(--line); height: auto; }
.example figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 8px; }
.what { padding-left: 20px; }
.what li { margin-bottom: 10px; }

/* panels */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.stat { font-size: 1.5rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.85rem; }

/* forms */
input[type='text'], input[type='search'], input[type='number'], select, textarea {
  width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: 0.95rem var(--font);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); outline-offset: 0; border-color: transparent; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.field { margin-bottom: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 150px; }
.row > .btn { flex: 0 0 auto; min-width: 0; }

/* commands */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; }
.toolbar input { flex: 1; min-width: 220px; }
.toolbar select { width: auto; }
.cmd-category h2 { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.cmd { padding: 12px 0; border-bottom: 1px solid var(--line); }
.cmd:last-child { border-bottom: 0; }
.cmd-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.cmd-name { font-family: var(--mono); font-weight: 700; color: var(--orange); }
.cmd-desc { margin: 2px 0 0; }
.badge { font-size: 0.75rem; color: var(--muted); }
.badge::before { content: '· '; }
.badge.server { color: #b9a6ff; }
.badge.perm { color: var(--yellow); }
.cmd-options { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 0.875rem; }
.cmd-options code { color: var(--text); }

/* dashboard */
.profile { display: flex; align-items: center; gap: 14px; }
.profile img { width: 56px; height: 56px; border-radius: 50%; }
.profile p { margin: 0; }
.small-h1 { font-size: 1.5rem; margin-bottom: 2px; }
.server-card { display: flex; align-items: center; gap: 12px; }
.server-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--panel-2); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; object-fit: cover; font-size: 0.9rem; }
.server-card .info { flex: 1; min-width: 0; }
.server-card .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.page-head .server-icon { width: 56px; height: 56px; }
.page-head p { margin: 0; }
.back { display: inline-block; margin-bottom: 18px; color: var(--muted); }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle p { margin: 0; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; margin: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: var(--muted); transition: transform 0.12s; }
.switch input:checked + .slider { background: var(--green); border-color: var(--green); }
.switch input:checked + .slider::before { transform: translateX(18px); background: #10331f; }
.switch input:focus-visible + .slider { outline: 2px solid var(--orange); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.table-wrap { overflow-x: auto; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }

.danger-zone { border-color: #5a3134; }
.danger-zone h3 { color: var(--red); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 22px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 12px; font: 600 0.95rem var(--font); cursor: pointer; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--orange); }

.notice { padding: 10px 14px; border-radius: 6px; background: var(--panel); border-left: 3px solid var(--muted); margin: 14px 0; }
.notice.error { border-left-color: var(--red); }
.notice.warn { border-left-color: var(--yellow); }
.empty, .skeleton { color: var(--muted); }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); opacity: 0; pointer-events: none; background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 6px; transition: opacity 0.15s; z-index: 50; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; }
#toast.error { border-color: var(--red); }

/* legal */
.legal { max-width: 720px; }
.legal h2 { font-size: 1.15rem; margin-top: 32px; }
.legal ul { padding-left: 22px; }
.legal li { margin-bottom: 6px; }

footer { border-top: 1px solid var(--line); padding: 20px; color: var(--muted); font-size: 0.875rem; }
footer .inner { max-width: 920px; margin: 0 auto; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
footer a { color: var(--muted); }
footer a:hover { color: var(--text); }

@media (max-width: 640px) {
  main { padding: 28px 16px 56px; }
  .intro { flex-direction: column; gap: 16px; }
  .intro h1 { font-size: 1.8rem; }
}

/* wider pages (server settings, developer) */
main.wide { max-width: 1120px; }
textarea { width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 0.95rem/1.5 var(--font); resize: vertical; }
.mono { font-family: var(--mono); }
.bad, .error-text { color: var(--red); }
.error-text { font-family: var(--mono); font-size: 0.85rem; word-break: break-word; }
.flush { margin: 0; }
.spaced { margin: 18px 0; }
.clickable { cursor: pointer; }
.clickable:hover td { background: var(--panel); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* dashboard */
.me { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.me-avatar { width: 72px; height: 72px; border-radius: 50%; }
.me-name { flex: 1; min-width: 180px; }
.me-name h1 { font-size: 1.7rem; margin: 0; }
.me-name p { margin: 0; }
.quick-row { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.quick { display: flex; flex-direction: column; padding: 8px 18px; border-right: 1px solid var(--line); min-width: 90px; }
.quick:last-child { border-right: 0; }
.quick strong { font-size: 1.2rem; }
.quick span { font-size: 0.8rem; color: var(--muted); }
.section-head p { margin-top: -4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); text-decoration: none; }
.tile:hover { border-color: var(--orange); color: var(--text); }
.tile.dim { opacity: 0.7; }
.tile.dim:hover { opacity: 1; }
.tile-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--panel-2); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; object-fit: cover; }
.tile-body { flex: 1; min-width: 0; }
.tile-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-meta { font-size: 0.8rem; color: var(--muted); }
.tile-go { font-size: 0.85rem; color: var(--orange); white-space: nowrap; }
.danger-details { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.danger-details summary { cursor: pointer; color: var(--red); font-weight: 600; }
.danger-details[open] summary { margin-bottom: 10px; }

/* server page */
.layout { display: grid; grid-template-columns: 190px 1fr; gap: 32px; align-items: start; }
.side-nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; }
.side-nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; border-left: 2px solid transparent; }
.side-nav a:hover { color: var(--text); background: var(--panel); border-left-color: var(--orange); }
.sections { min-width: 0; }
.panel { padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid var(--line); scroll-margin-top: 16px; }
.panel:last-child { border-bottom: 0; }
.panel h2 { margin-top: 0; }
.module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.module { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 400; margin: 0; }
.module.on { border-color: #2f5a41; }
.module div { display: flex; flex-direction: column; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { font: 0.8rem var(--mono); padding: 3px 8px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--orange); }
.preview { background: #313338; border-radius: 8px; padding: 12px 14px; color: #dbdee1; }
.preview-author { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.preview-author img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.preview-author strong { color: #f2f3f5; }
.bot-tag { font-size: 0.65rem; font-weight: 700; background: #5865f2; color: #fff; padding: 1px 4px; border-radius: 3px; }
.preview-text { white-space: pre-wrap; word-break: break-word; }
.mention { background: rgba(88, 101, 242, 0.3); color: #c9cdfb; padding: 0 2px; border-radius: 3px; }

/* developer */
.health { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; margin-bottom: 18px; }
.health-item { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: 0.9rem; }
.health-item .muted { width: 100%; font-size: 0.82rem; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar-fill { width: 100%; background: var(--orange); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar-value { font-size: 0.7rem; color: var(--muted); }
.bar-label { font-size: 0.68rem; color: var(--muted); margin-top: 4px; white-space: nowrap; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .side-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .two-col, .module-grid { grid-template-columns: 1fr; }
  .bar-label { display: none; }
}
