:root {
  --bg: #111318; --panel: #1a1d24; --panel2: #22262f; --line: #2d323d;
  --text: #e8eaef; --muted: #9aa1ad; --accent: #5865f2; --accent2: #4752c4;
  --ok: #3ba55d; --bad: #ed4245; --warn: #faa61a; --radius: 10px;
}
* { 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: #8ea1ff; text-decoration: none; }
h1 { font-size: 1.6rem; margin: 0 0 .3rem; } h2 { margin-top: 2rem; } h3 { margin: 0 0 .6rem; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 4px; }
.muted { color: var(--muted); } .help { color: var(--muted); font-size: .85rem; margin: .3rem 0 0; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .7rem 1.2rem; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { color: var(--text); font-weight: 700; font-size: 1.1rem; }
.logo { color: var(--accent); }
.topbar nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topbar nav a { color: var(--text); }
.me { display: flex; align-items: center; gap: .4rem; color: var(--muted); }
.me img { width: 28px; height: 28px; border-radius: 50%; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px; }
.btn { display: inline-block; background: var(--accent); color: #fff !important; border: 0; cursor: pointer;
  padding: .55rem 1.1rem; border-radius: 6px; font: inherit; font-weight: 600; }
.btn:hover { background: var(--accent2); }
.btn.small { padding: .3rem .7rem; font-size: .85rem; }
.btn.big { padding: .8rem 1.6rem; font-size: 1.05rem; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--panel2); }
.btn.danger { background: var(--bad); }

.flash { margin: 1rem auto 0; max-width: 1100px; padding: .7rem 1rem; border-radius: 6px;
  background: rgba(59,165,93,.15); border: 1px solid var(--ok); }
.flash.error { background: rgba(237,66,69,.15); border-color: var(--bad); }
.notice { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem;
  background: rgba(250,166,26,.12); border: 1px solid var(--warn); }

.hero { text-align: center; padding: 5rem 1rem; }
.hero h1 { font-size: 2.6rem; }
.hero p { max-width: 640px; margin: 1rem auto 2rem; color: var(--muted); font-size: 1.1rem; }

.grid { display: grid; gap: 1rem; }
.grid.servers { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid.modules { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem; margin-bottom: 1rem; overflow-x: auto; }
.card.server { text-align: center; }
.card.server img, .ph.big { width: 72px; height: 72px; border-radius: 50%; display: inline-flex; }
.ph { display: inline-flex; align-items: center; justify-content: center; background: var(--panel2);
  border-radius: 50%; width: 36px; height: 36px; font-weight: 700; }
.ph.big { font-size: 1.6rem; }
.card.module.off { opacity: .6; }
.mod-head { display: flex; align-items: center; gap: .6rem; }
.mod-head h3 { margin: 0; flex: 1; }
.icon { font-size: 1.4rem; }

.pill { border: 1px solid var(--line); background: var(--panel2); color: var(--muted);
  border-radius: 999px; padding: .2rem .8rem; cursor: pointer; font: inherit; font-size: .85rem; }
.pill.on { background: rgba(59,165,93,.2); border-color: var(--ok); color: #8fe0a8; }

.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 250px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line); padding: 1rem .6rem; }
.guild-head { display: flex; align-items: center; gap: .6rem; padding: .4rem .6rem 1rem; color: var(--text); }
.guild-head img { width: 36px; height: 36px; border-radius: 50%; }
.nav-item { display: block; padding: .45rem .7rem; border-radius: 6px; color: var(--muted); }
.nav-item:hover { background: var(--panel2); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; }
.content { flex: 1; padding: 1.5rem 2rem; max-width: 1000px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-top: 1rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; color: var(--muted); }
.stat span { display: block; font-size: 1.7rem; font-weight: 700; color: var(--text); }

.form .field { margin-bottom: 1.1rem; }
.form label { display: block; font-weight: 600; margin-bottom: .3rem; }
input[type=text], input[type=number], textarea, select {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: .5rem .6rem; font: inherit; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.checklist { max-height: 200px; overflow-y: auto; background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: .5rem; columns: 2 200px; }
.checklist label { font-weight: 400; margin: 0 0 .2rem; break-inside: avoid; }

.switch { display: flex !important; align-items: center; gap: .6rem; cursor: pointer; font-weight: 600; }
.switch input { display: none; }
.switch span { width: 40px; height: 22px; background: var(--line); border-radius: 999px; position: relative; flex-shrink: 0; transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { left: 21px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
table.rewards td { padding: .3rem; }
.tag { display: inline-block; background: var(--panel2); border-radius: 4px; padding: 0 .4rem; margin: 0 .2rem .2rem 0; }

.lb-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.lb-head img { width: 56px; height: 56px; border-radius: 50%; }
.lb-row { display: flex; align-items: center; gap: 1rem; padding: .7rem .3rem; border-bottom: 1px solid var(--line); }
.lb-row img { width: 40px; height: 40px; border-radius: 50%; }
.pos { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--panel2); font-weight: 700; flex-shrink: 0; }
.pos-1 { background: #d4a72c; color: #000; } .pos-2 { background: #a7adb7; color: #000; } .pos-3 { background: #b0703c; }
.lb-name { flex: 1; min-width: 0; }
.bar { height: 6px; background: var(--panel2); border-radius: 3px; margin-top: .3rem; }
.bar div { height: 100%; background: var(--accent); border-radius: 3px; }
.lb-num, .lb-level { text-align: center; color: var(--muted); font-size: .75rem; min-width: 56px; }
.lb-num span, .lb-level span { display: block; color: var(--text); font-size: 1rem; font-weight: 600; }
.lb-level span { font-size: 1.3rem; color: #8ea1ff; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); display: flex; overflow-x: auto; gap: .2rem; padding: .5rem; }
  .guild-head { display: none; }
  .nav-item { white-space: nowrap; }
  .content { padding: 1rem 16px; }
  .lb-num { display: none; }
}
