:root {
  --bg: #0f1117;
  --bg2: #161922;
  --card: #1c2030;
  --line: #2a3042;
  --text: #e6e8ef;
  --muted: #9aa1b5;
  --accent: #5865f2;
  --accent2: #4752c4;
  --ok: #3ba55d;
  --danger: #ed4245;
  --warn: #faa61a;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
h1 { margin: 0 0 .25rem; font-size: 1.7rem; }
h2 { margin: 2rem 0 1rem; font-size: 1.2rem; }
h3 { margin: 0 0 1rem; font-size: 1.05rem; }
code { background: #0b0d12; padding: 1px 6px; border-radius: 5px; font-size: .88em; }
.muted { color: var(--muted); }
.center { text-align: center; justify-content: center; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* Topbar */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1.4rem; background: var(--bg2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.1rem; }
.brand img { width: 34px; height: 34px; border-radius: 50%; }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
.me { display: flex; align-items: center; gap: .4rem; color: var(--muted); }
.me img { width: 28px; height: 28px; border-radius: 50%; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .4rem; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: .6rem 1.1rem; font-weight: 600; cursor: pointer; font-size: .95rem; transition: background .15s; }
.btn:hover { background: var(--accent2); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--card); }
.btn.danger { background: var(--danger); }
.btn.small { padding: .35rem .75rem; font-size: .85rem; }
.btn.big { padding: .85rem 1.6rem; font-size: 1.05rem; }

/* Landing */
.hero { max-width: 960px; margin: 4rem auto; text-align: center; padding: 0 1rem; }
.hero h1 { font-size: 2.6rem; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 640px; margin: .6rem auto 1.8rem; }
.hero-avatar { width: 110px; height: 110px; border-radius: 50%; box-shadow: 0 0 0 6px var(--card); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 3rem; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; display: flex; flex-direction: column; gap: .2rem; text-align: left; }
.feature span { font-size: 1.6rem; }
.feature small { color: var(--muted); }

/* Serverauswahl */
.container { max-width: 1100px; margin: 2.5rem auto; padding: 0 1.2rem; }
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.server { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .7rem; text-align: center; }
.server img { width: 72px; height: 72px; border-radius: 50%; }
.server.nobot img, .server.nobot .gicon { filter: grayscale(1); opacity: .6; }
.gicon { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.gicon.big { width: 72px; height: 72px; font-size: 1.4rem; }

/* Layout mit Sidebar */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 57px); }
.sidebar { background: var(--bg2); border-right: 1px solid var(--line); padding: 1rem .7rem; position: sticky; top: 57px; height: calc(100vh - 57px); overflow-y: auto; }
.guild-head { display: flex; align-items: center; gap: .6rem; font-weight: 700; padding: .5rem; margin-bottom: .8rem; }
.guild-head img { width: 36px; height: 36px; border-radius: 50%; }
.sidebar nav a { display: block; padding: .55rem .8rem; border-radius: 8px; color: var(--muted); margin-bottom: 2px; }
.sidebar nav a:hover { background: var(--card); color: var(--text); }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.content { padding: 2rem 2.4rem 7rem; max-width: 1100px; }

/* Übersicht */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.stat b { display: block; font-size: 1.7rem; }
.stat span { color: var(--muted); font-size: .9rem; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.module-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; align-items: center; gap: .8rem; transition: border-color .15s, transform .15s; }
.module-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.module-card small { display: block; color: var(--muted); }
.module-card > div { flex: 1; }
.micon { font-size: 1.6rem; }
.badge { font-size: .75rem; padding: .15rem .55rem; border-radius: 99px; background: var(--line); white-space: nowrap; }
.badge.on { background: rgba(59,165,93,.2); color: #6fdc8c; }
.badge.off { background: rgba(237,66,69,.15); color: #f08b8d; }

/* Karten & Formulare */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; margin: 1rem 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 1.2rem; }
.field { display: block; margin-bottom: 1rem; }
.label { display: block; font-weight: 600; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: .35rem; }
.hint { display: block; color: var(--muted); font-size: .82rem; margin-top: .3rem; text-transform: none; letter-spacing: 0; font-weight: 400; }
input, select, textarea { width: 100%; background: #0b0d12; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
input[type=color] { height: 42px; padding: 4px; cursor: pointer; }
select.multi { min-height: 130px; }
textarea { resize: vertical; }

.toggle { display: flex; align-items: flex-start; gap: .75rem; cursor: pointer; margin-bottom: .9rem; }
.toggle input { display: none; }
.slider { width: 42px; height: 24px; background: var(--line); border-radius: 99px; position: relative; flex-shrink: 0; transition: background .2s; }
.slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + .slider { background: var(--ok); }
.toggle input:checked + .slider::after { transform: translateX(18px); }
.toggle-label { font-weight: 600; }

.item.inline { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; flex-wrap: wrap; }
.item.inline > input, .item.inline > select { flex: 1; min-width: 140px; width: auto; }
.item.inline .emoji { flex: 0 0 70px; min-width: 70px; text-align: center; }
.item.inline .num { flex: 0 0 80px; min-width: 80px; }
.item.card { background: var(--bg2); }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: .5rem; flex-wrap: wrap; }
.item-head input { width: 220px; }
.prefix { font-size: 1rem; }

.ordered ol { list-style: decimal; padding-left: 1.6rem; margin: 0 0 .7rem; }
.ordered li { display: flex; justify-content: space-between; align-items: center; background: #0b0d12; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem; margin-bottom: .35rem; }
.ordered li::marker { color: var(--muted); }
.ord-btns button { background: var(--line); color: var(--text); border: 0; border-radius: 6px; padding: .2rem .5rem; margin-left: .25rem; cursor: pointer; }
.ordered .row select { flex: 1; width: auto; }

.alert { border-radius: var(--radius); padding: .9rem 1.1rem; margin: 1rem 0; }
.alert .btn { margin-left: .6rem; }
.alert.info { background: rgba(88,101,242,.12); border: 1px solid rgba(88,101,242,.35); }
.alert.danger { background: rgba(237,66,69,.15); border: 1px solid rgba(237,66,69,.45); }

.vars { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .4rem; padding: 0; list-style: none; }

.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table td { padding: .5rem .4rem; border-top: 1px solid var(--line); vertical-align: top; }

/* Speicherleiste */
.savebar { position: fixed; bottom: -90px; left: 50%; transform: translateX(-50%); background: #0b0d12; border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; display: flex; gap: .8rem; align-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.5); transition: bottom .25s; z-index: 20; }
.savebar.show { bottom: 22px; }

#toast { position: fixed; top: 75px; right: 20px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--ok); padding: .8rem 1.1rem; border-radius: 8px; opacity: 0; transform: translateY(-10px); transition: .25s; z-index: 30; pointer-events: none; }
#toast.show { opacity: 1; transform: none; }
#toast.err { border-left-color: var(--danger); }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { display: flex; overflow-x: auto; gap: .3rem; }
  .sidebar nav a { white-space: nowrap; }
  .content { padding: 1.2rem 1rem 7rem; }
  .me { display: none; }
}
