:root {
  color-scheme: dark;
  --bg: #1e1e1e;
  --bar: #272727;
  --side: #212121;
  --card: #2b2b2b;
  --card2: #323232;
  --line: #3a3a3a;
  --text: #e8e8e8;
  --muted: #a8a8a8;
  --accent: #03a9f4;
  --accent-dim: rgba(3, 169, 244, .14);
  --green: #00c853;
  --red: #ff5252;
  --orange: #ffa726;
  --radius: 4px;
  --side-w: 240px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 Roboto, "Segoe UI", system-ui, -apple-system, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 22px; height: 22px; fill: currentColor; flex: none; }
svg.i.sm { width: 18px; height: 18px; }

.topbar { position: fixed; inset: 0 0 auto 0; height: 56px; background: var(--bar); display: flex; align-items: center; gap: 12px; padding: 0 16px; z-index: 20; box-shadow: 0 1px 0 #000; }
.topbar .title { font-size: 22px; font-weight: 400; margin-left: 4px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { height: 32px; width: auto; }
.brand-full { height: 34px; width: auto; }
.ptag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; color: #fff; margin-left: 8px; line-height: 18px; white-space: nowrap; }
.server .plist .p { gap: 8px; }
.server .plist .p img { width: 20px; height: 20px; border-radius: 3px; image-rendering: pixelated; flex: none; }
.plist .more { color: var(--muted); cursor: pointer; padding-top: 4px; display: inline-block; }
.plist .more:hover { color: var(--text); }
.topbar .grow { flex: 1; }
.iconbtn { background: none; border: 0; padding: 8px; border-radius: 50%; cursor: pointer; display: inline-flex; color: var(--text); }
.iconbtn:hover { background: rgba(255,255,255,.08); }
.pill { background: #3a3a3a; border: 0; border-radius: 16px; padding: 6px 12px; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; color: var(--text); }
.pill:hover { background: #454545; text-decoration: none; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #444; object-fit: cover; flex: none; }
.avatar.sm { width: 28px; height: 28px; }
.avatar.xs { width: 22px; height: 22px; border-radius: 3px; }
.menu { position: absolute; right: 12px; top: 54px; background: var(--card2); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.5); min-width: 220px; padding: 6px 0; z-index: 30; }
.menu .who { padding: 10px 16px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu a, .menu button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px 16px; background: none; border: 0; color: var(--text); cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: rgba(255,255,255,.06); text-decoration: none; }

.sidebar { position: fixed; top: 56px; bottom: 0; left: 0; width: var(--side-w); background: var(--side); overflow-y: auto; padding: 16px 0; z-index: 10; transition: transform .2s; }
.sidebar.closed { transform: translateX(-100%); }
.nav a { display: flex; align-items: center; gap: 18px; padding: 10px 16px; color: #cfcfcf; font-size: 14px; border-right: 2px solid transparent; }
.nav a:hover { background: rgba(255,255,255,.04); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-dim); border-right-color: var(--accent); }
.nav a.sub { padding-left: 36px; }
.nav .group { display: flex; align-items: center; gap: 18px; padding: 10px 16px; margin-top: 16px; color: #cfcfcf; cursor: pointer; user-select: none; }
.nav .group .caret { margin-left: auto; color: var(--accent); transition: transform .15s; }
.nav .group.collapsed .caret { transform: rotate(-90deg); color: var(--muted); }
.nav .groupbody.collapsed { display: none; }

.main { margin-left: var(--side-w); padding: 80px 24px 40px; min-height: 100vh; transition: margin .2s; }
.main.full { margin-left: 0; }
.center { max-width: 1400px; margin: 0 auto; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 2px 4px rgba(0,0,0,.25); }
.card .hd { padding: 20px 16px 8px; font-size: 20px; font-weight: 500; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card .bd { padding: 8px 16px 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grid { display: grid; gap: 24px; }
.grid.cols3 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid.cols4 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .grid.split { grid-template-columns: 1fr; } }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack > * + * { margin-top: 12px; }
.spacer { flex: 1; }
h3.sec { font-size: 14px; font-weight: 600; margin: 16px 0 2px; }

.tabs { background: var(--accent); display: flex; justify-content: center; flex-wrap: wrap; border-radius: var(--radius) var(--radius) 0 0; }
.tabs a { color: #fff; font-weight: 600; font-size: 13px; letter-spacing: .03em; text-transform: uppercase; padding: 14px 22px; border-bottom: 2px solid transparent; display: inline-flex; gap: 8px; align-items: center; opacity: .92; }
.tabs a:hover { text-decoration: none; background: rgba(255,255,255,.08); opacity: 1; }
.tabs a.active { border-bottom-color: #fff; opacity: 1; }
.tabbed { border-radius: 0 0 var(--radius) var(--radius); }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-weight: 600; font-size: 13px; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:hover td { background: rgba(255,255,255,.02); }
table.t td.nowrap, table.t th.nowrap { white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 18px; padding: 10px 16px; font-size: 13px; }
.pager select { background: transparent; border: 0; }
.pager select option { background: var(--card2); }

.btn { background: var(--accent); color: #fff; border: 0; border-radius: var(--radius); padding: 9px 16px; font-weight: 600; font-size: 13px; letter-spacing: .03em; text-transform: uppercase; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn.block { width: 100%; }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.flat { background: transparent; color: var(--accent); padding: 6px 8px; }
.btn.flat.green { color: var(--green); }
.btn.flat.red { color: var(--red); }
.btn.outline { background: transparent; border: 1px solid #ddd; color: #fff; }
.btn.discord { background: #5865f2; }

.field { display: flex; flex-direction: column; gap: 4px; background: var(--card2); border-radius: var(--radius) var(--radius) 0 0; border-bottom: 1px solid #777; padding: 8px 12px 6px; }
.field:focus-within { border-bottom-color: var(--accent); }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea { background: transparent; border: 0; outline: 0; padding: 2px 0; width: 100%; }
.field select option { background: var(--card2); }
.field textarea { min-height: 90px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 4px 0; }
.search { display: flex; align-items: center; background: var(--card2); border-bottom: 1px solid #777; padding: 0 12px; min-width: 260px; flex: 1; max-width: 520px; }
.search input { flex: 1; background: transparent; border: 0; outline: 0; padding: 12px 0; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; padding: 4px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.switch { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 34px; height: 14px; background: #7a2b2b; border-radius: 7px; position: relative; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: -3px; left: -2px; width: 20px; height: 20px; border-radius: 50%; background: var(--red); transition: left .15s, background .15s; }
.switch input:checked { background: #1d5f7c; }
.switch input:checked::after { left: 16px; background: var(--accent); }
.errors { color: var(--red); line-height: 1.7; }
.ok { color: var(--green); }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 12px; font-size: 12px; font-weight: 500; color: #fff; background: #555; white-space: nowrap; }
.chip.blue { background: #1e88e5; }
.chip.green { background: var(--green); }
.chip.red { background: #e53935; }
.chip.orange { background: #fb8c00; }
.chip.grey { background: #505050; }
.chip.staff { background: #1e88e5; border-radius: 3px; padding: 3px 8px; margin-left: 8px; }
.banner { border-radius: var(--radius); padding: 12px 16px; display: flex; gap: 12px; align-items: flex-start; }
.banner.green { background: rgba(0, 200, 83, .08); color: #4caf50; }
.banner.red { background: rgba(255, 82, 82, .08); color: #ef5350; }
.banner.blue { background: rgba(3, 169, 244, .08); color: var(--accent); }

.server h2, .card h2 { font-size: 20px; font-weight: 500; margin: 0 0 18px; }
.server .plist a { display: block; line-height: 1.6; }
.server .plist .p { display: flex; align-items: center; min-height: 30px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #777; }
.dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.off { background: var(--red); }

.rolecard { text-align: center; }
.rolecard h2 { font-size: 22px; margin: 0 0 18px; font-weight: 400; }
.rolecard .m { display: flex; align-items: center; gap: 12px; text-align: left; padding: 6px 0; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; overflow-y: auto; }
.modal { background: var(--card); border-radius: var(--radius); width: 100%; max-width: 560px; box-shadow: 0 12px 40px rgba(0,0,0,.6); }
.modal.wide { max-width: 860px; }
.modal .hd { padding: 18px 20px 6px; font-size: 20px; font-weight: 500; }
.modal .bd { padding: 10px 20px; }
.modal .ft { padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #333; color: #fff; padding: 12px 18px; border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.5); min-width: 260px; max-width: 90vw; }
.toast.err { background: #c62828; }
.toast.ok { background: #2e7d32; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; }
.kv b { font-weight: 600; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.console { background: #111; border-radius: var(--radius); padding: 12px; min-height: 260px; max-height: 520px; overflow-y: auto; white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.console .cmd { color: var(--accent); }
.console .err { color: var(--red); }
.keybox { background: #111; border: 1px dashed var(--accent); padding: 12px; border-radius: var(--radius); word-break: break-all; font-family: ui-monospace, Consolas, monospace; }
.color-in { width: 44px; height: 32px; border: 0; background: none; padding: 0; cursor: pointer; }
.permgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 18px; }
.permgrid h4 { grid-column: 1 / -1; margin: 12px 0 2px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.reasons .r { display: grid; grid-template-columns: 1fr 140px 40px; gap: 8px; align-items: end; margin-bottom: 8px; }

.hero { max-width: 760px; margin: 40px auto; text-align: center; }
.hero h1 { font-size: 44px; margin: 0 0 6px; font-weight: 500; }
.hero p { color: var(--muted); font-size: 16px; }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.ellipsis { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap { white-space: pre-wrap; word-break: break-word; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 8px 0 24px rgba(0,0,0,.5); }
  .main { margin-left: 0; padding: 72px 10px 30px; }
  .topbar .pill span { display: none; }
}
