:root {
  --bg: #1e1f22;
  --panel: #2b2d31;
  --panel-2: #313338;
  --border: #3f4147;
  --text: #f2f3f5;
  --muted: #a6a8ad;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --green: #23a55a;
  --red: #da373c;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
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; }
main { max-width: 1150px; margin: 0 auto; padding: 24px 16px 48px; }
.muted { color: var(--muted); margin: 2px 0 0; }
.small { font-size: 13px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: #111214; border-bottom: 1px solid #000;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand img, .me img { width: 32px; height: 32px; border-radius: 50%; }
.topbar nav { display: flex; align-items: center; gap: 14px; }
.topbar nav > a:not(.btn) { color: var(--text); }
.me { display: flex; align-items: center; gap: 8px; color: var(--muted); }
@media (max-width: 640px) { .me { display: none; } }

/* Buttons */
.btn {
  display: inline-block; padding: 8px 16px; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-lg { padding: 12px 24px; font-size: 16px; }

/* Hero */
.hero { text-align: center; padding: 80px 0 40px; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); margin: 0 0 12px; }
.hero p { max-width: 640px; margin: 0 auto 28px; color: var(--muted); font-size: 17px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Server grid */
.page-title { margin: 0; font-size: 26px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; margin-top: 24px; }
.server-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); text-align: center;
}
.server-icon { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.server-icon.placeholder { display: grid; place-items: center; background: var(--panel-2); font-weight: 700; font-size: 20px; }
.server-name { font-weight: 600; word-break: break-word; }
.empty { color: var(--muted); }

/* Guild page */
.guild-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.guild-head .server-icon { width: 64px; height: 64px; }
.layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.sidebar {
  position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px;
}
.side-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--text); }
.side-link:hover { background: var(--panel-2); text-decoration: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #4e5058; flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
}

.modules { display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: border-color .3s; }
.card.active { border-color: var(--accent); }
.card-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.card-head h2 { margin: 0; font-size: 19px; }
.card-foot { display: flex; justify-content: flex-end; margin-top: 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 18px; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-textarea, .field-list, .field-roles, .field-channels, .field-levelroles { grid-column: 1 / -1; }
.field > label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
input[type=text], input[type=number], input[type=search], textarea, select {
  width: 100%; padding: 9px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; }
.field > label.check { text-transform: none; letter-spacing: 0; font-size: 15px; font-weight: 500; color: var(--text); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; padding-top: 4px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Toggle switch */
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #4e5058; border-radius: 26px; cursor: pointer; transition: .2s; }
.slider::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* Pickers */
.picker { border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.picker-filter { border: 0 !important; border-bottom: 1px solid var(--border) !important; border-radius: 6px 6px 0 0 !important; }
.picker-list { max-height: 200px; overflow-y: auto; padding: 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px; }
.picker-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 4px; cursor: pointer; }
.picker-item:hover { background: var(--panel-2); }
.picker-item input { accent-color: var(--accent); }
.role-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.warn { color: #f0b232; margin-left: auto; }

.levelroles { display: flex; flex-direction: column; gap: 8px; }
.levelrole-row { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; transition: opacity .6s; }
.flash-success { background: rgba(35, 165, 90, .15); border: 1px solid var(--green); }
.flash.hide { opacity: 0; }

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; }
