:root {
  --bg: #0f1117;
  --bg-2: #161922;
  --card: #1c202b;
  --card-2: #232836;
  --border: #2b3142;
  --text: #e8eaf0;
  --muted: #9aa1b4;
  --accent: #7c5cff;
  --accent-2: #a18bff;
  --success: #3ba55d;
  --danger: #ed4245;
  --warn: #faa61a;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; line-height: 1.5; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .65em 1.2em; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; color: #fff; background: var(--accent);
  transition: transform .1s, background .15s, opacity .15s; text-decoration: none !important; white-space: nowrap;
}
.btn:hover { background: #6a48ff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--card-2); border-color: var(--border); color: var(--text); }
.btn.secondary:hover { background: #2b3142; }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--success); }
.btn.small { padding: .35em .8em; font-size: .85em; border-radius: 8px; }
.btn.big { padding: .9em 1.8em; font-size: 1.05em; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; gap: 16px;
  padding: 0 24px; background: rgba(15, 17, 23, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15em; color: var(--text) !important; text-decoration: none !important; }
.brand img, .brand .logo { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; }
.topbar .spacer { flex: 1; }
.user-slot { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--text); }
.user-chip img { width: 32px; height: 32px; border-radius: 50%; }

/* ---------- Landing ---------- */
.hero { max-width: 1100px; margin: 0 auto; padding: 90px 24px 60px; text-align: center; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); letter-spacing: -.02em; }
.hero h1 span { background: linear-gradient(90deg, var(--accent-2), #4fd1c5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 1.2em; color: var(--muted); max-width: 640px; margin: 0 auto 2em; }
.hero .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .count { margin-top: 1.5em; color: var(--muted); }
.features { max-width: 1100px; margin: 0 auto; padding: 20px 24px 80px; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.feature { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.feature .icon { font-size: 1.8em; }
.feature h3 { margin-top: .5em; }
.feature p { color: var(--muted); margin: 0; }
.notice { max-width: 600px; margin: 20px auto 0; padding: 12px 16px; border-radius: 10px; background: rgba(237, 66, 69, .15); border: 1px solid var(--danger); }

/* ---------- Server-Auswahl ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 40px 24px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.guild-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.guild-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; transition: border-color .15s, transform .15s;
}
.guild-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.guild-card.inactive { opacity: .75; }
.guild-card .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.guild-icon {
  width: 80px; height: 80px; border-radius: 22px; background: var(--card-2); display: grid; place-items: center;
  font-weight: 700; font-size: 1.4em; color: var(--muted); overflow: hidden; flex: none;
}
.guild-icon img { width: 100%; height: 100%; object-fit: cover; }
.guild-icon.small { width: 44px; height: 44px; border-radius: 12px; font-size: 1em; }
.badge { font-size: .75em; padding: .2em .6em; border-radius: 99px; background: var(--card-2); color: var(--muted); border: 1px solid var(--border); }
.badge.on { color: #8ef0b0; border-color: rgba(59, 165, 93, .5); background: rgba(59, 165, 93, .12); }
.badge.warn { color: #ffd38a; border-color: rgba(250, 166, 26, .5); background: rgba(250, 166, 26, .12); }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }

/* ---------- Server-Dashboard ---------- */
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 64px); }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--border); padding: 20px 14px; position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; }
.sidebar .guild-head { display: flex; align-items: center; gap: 12px; padding: 0 8px 18px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.sidebar .guild-head .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-label { font-size: .72em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--muted);
  cursor: pointer; text-decoration: none !important; user-select: none;
}
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { background: rgba(124, 92, 255, .16); color: var(--text); }
.nav-item .dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.nav-item .dot.on { background: var(--success); }
.main { padding: 32px clamp(16px, 4vw, 48px) 120px; max-width: 1000px; width: 100%; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-head p { margin: 0; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.card h3 { font-size: 1.05em; }
.card.disabled { opacity: .55; pointer-events: none; }

.field { padding: 14px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr minmax(220px, 340px); gap: 18px; align-items: center; }
.field:last-child { border-bottom: 0; }
.field.wide { grid-template-columns: 1fr; }
.field label { font-weight: 600; display: block; }
.field .help { color: var(--muted); font-size: .88em; margin-top: 2px; }
.field-heading { padding: 18px 0 4px; font-weight: 700; color: var(--accent-2); font-size: .9em; text-transform: uppercase; letter-spacing: .05em; }

input[type=text], input[type=number], select, textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: .6em .8em; font: inherit; outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }

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

/* Chips (Mehrfachauswahl / Tags) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: .25em .4em .25em .7em; border-radius: 99px; background: var(--card-2); border: 1px solid var(--border); font-size: .88em; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1em; line-height: 1; padding: 0 4px; }
.chip button:hover { color: var(--danger); }
.chip .swatch { width: 10px; height: 10px; border-radius: 50%; }
.tag-input { display: flex; gap: 6px; }

/* Module-Kacheln */
.module-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.module { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; gap: 14px; align-items: flex-start; }
.module .icon { font-size: 1.6em; }
.module .body { flex: 1; min-width: 0; }
.module h4 { margin: 0 0 4px; }
.module p { margin: 0 0 10px; color: var(--muted); font-size: .88em; }
.module .link { font-size: .88em; cursor: pointer; }

.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 26px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat .value { font-size: 1.8em; font-weight: 700; }
.stat .label { color: var(--muted); font-size: .88em; }

/* Tabelle */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92em; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85em; text-transform: uppercase; letter-spacing: .04em; }
td.reason { max-width: 280px; word-break: break-word; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 180px; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 14px; }

/* Speicherleiste */
.savebar {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 150%); z-index: 50;
  display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 20px; border-radius: 14px;
  background: #0b0d12; border: 1px solid var(--border); box-shadow: var(--shadow); transition: transform .25s; width: min(640px, calc(100% - 32px));
}
.savebar.show { transform: translate(-50%, 0); }
.savebar .text { flex: 1; }

.toast {
  position: fixed; right: 24px; top: 84px; z-index: 60; padding: 12px 18px; border-radius: 10px; background: var(--success);
  color: #fff; font-weight: 600; box-shadow: var(--shadow); opacity: 0; transform: translateY(-10px); transition: all .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--danger); }

.loader { display: grid; place-items: center; padding: 80px; color: var(--muted); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.soon { text-align: center; padding: 50px 20px; }
.soon .icon { font-size: 3em; }
.placeholders code { background: var(--bg); padding: .1em .4em; border-radius: 4px; margin-right: 4px; }
.menu-btn { display: none; }
.toast { white-space: pre-line; max-width: min(460px, calc(100% - 48px)); }

/* Rollen-Panels */
.panel-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.panel-actions.end { justify-content: flex-end; }
.panel-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-card-head h3 { margin-bottom: 2px; }
.panel-buttons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.option-row { display: grid; grid-template-columns: 64px 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.option-row.type-buttons { grid-template-columns: 64px 1fr 1fr 100px auto; }
.option-row .emoji-input { text-align: center; font-size: 1.1em; }
input[type=color] { width: 64px; height: 38px; padding: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; justify-self: end; }
img.emoji { width: 1.25em; height: 1.25em; vertical-align: -0.25em; object-fit: contain; }
span.emoji { margin-right: 2px; }

.rule-card { border: 1px solid var(--border); border-left: 4px solid var(--success); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: var(--bg-2); }
.rule-card.action-alert { border-left-color: var(--accent); }
.rule-card.action-warn, .rule-card.action-timeout { border-left-color: var(--warn); }
.rule-card.action-kick, .rule-card.action-ban { border-left-color: var(--danger); }
.rule-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.rule-field { display: flex; flex-direction: column; gap: 4px; }
.rule-field > span { font-size: .8em; color: var(--muted); font-weight: 600; }
.rule-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .88em; white-space: nowrap; cursor: pointer; }
.warn-card { border-color: var(--warn); background: rgba(250, 166, 26, .08); }
.warn-card p { margin: 0; }

/* Discord-Vorschau */
.dc-preview { background: #313338; border-radius: 8px; padding: 16px; color: #dbdee1; font-size: .95em; }
.dc-author { font-weight: 600; color: #f2f3f5; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.dc-bot { background: #5865f2; color: #fff; font-size: .65em; padding: 1px 5px; border-radius: 4px; font-weight: 700; }
.dc-embed { background: #2b2d31; border-left: 4px solid var(--accent); border-radius: 4px; padding: 10px 14px 12px; max-width: 520px; }
.dc-title { font-weight: 700; color: #f2f3f5; margin-bottom: 4px; }
.dc-desc { white-space: pre-wrap; margin-top: 4px; }
.dc-footer { font-size: .8em; color: #b5bac1; margin-top: 8px; }
.dc-mention { background: rgba(88, 101, 242, .3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; }
.dc-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; max-width: 560px; }
.dc-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px; min-height: 32px; border-radius: 4px; color: #fff; font-weight: 500; font-size: .92em; background: #4e5058; }
.dc-btn.primary { background: #5865f2; }
.dc-btn.success { background: #248046; }
.dc-btn.danger { background: #da373c; }
.dc-select { margin-top: 8px; max-width: 420px; background: #1e1f22; border-radius: 4px; padding: 9px 12px; color: #949ba4; display: flex; justify-content: space-between; }
.dc-reactions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.dc-reaction { background: #2b2d31; border: 1px solid #3f4147; border-radius: 8px; padding: 2px 8px; font-size: .9em; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; left: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .menu-btn { display: inline-flex; }
  .field { grid-template-columns: 1fr; }
  .switch { justify-self: start; }
  .topbar { padding: 0 16px; }
  .user-chip .uname { display: none; }
  .option-row, .option-row.type-buttons { grid-template-columns: 56px 1fr auto; }
  .option-row select { grid-column: 1 / -1; }
}
