:root {
  --bg: #0f1117; --panel: #181b24; --panel2: #1f2330; --border: #2a2f3f;
  --text: #e6e8ef; --muted: #8a91a6; --accent: #5865f2; --accent2: #7983f5;
  --ok: #3ba55d; --warn: #faa61a; --bad: #ed4245; --footer-h: 30px;
  --footer-bg: #0a0c11; --rail-bg: #0b0d12; --danger-border: #5a2a2c; color-scheme: dark;
}
/* Helles Design */
:root[data-theme="light"] {
  --bg: #f3f4f8; --panel: #ffffff; --panel2: #eef0f6; --border: #d8dbe6;
  --text: #1b1e2b; --muted: #636b82; --accent: #5865f2; --accent2: #4752c4;
  --ok: #2e9b53; --warn: #b87a08; --bad: #d93a3d;
  --footer-bg: #e8eaf1; --rail-bg: #e2e5ee; --danger-border: #f0b4b6; color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, "Segoe UI", sans-serif; padding-bottom: var(--footer-h); }
.hidden { display: none !important; }
a { color: var(--accent2); }

.logo { font-weight: 600; font-size: 20px; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
.logo b { color: var(--accent2); }
.logo.big { font-size: 38px; justify-content: center; }
.px { width: 14px; height: 14px; background: var(--accent); box-shadow: 8px 8px 0 var(--accent2); margin-right: 8px; display: inline-block; }
.logo.big .px { width: 22px; height: 22px; box-shadow: 12px 12px 0 var(--accent2); margin-right: 14px; }

.login { min-height: calc(100vh - var(--footer-h)); display: grid; place-items: center; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 40px; text-align: center; max-width: 380px; display: grid; gap: 16px; }
.login-card p, .login-card small { color: var(--muted); margin: 0; }

.app { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - var(--footer-h)); }
.sidebar { background: var(--panel); border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; }
nav { display: grid; gap: 4px; }
nav button { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--muted); text-align: left; padding: 10px 12px; border-radius: 8px; font: inherit; cursor: pointer; }
nav button:hover { background: var(--panel2); color: var(--text); }
nav button.active { background: var(--accent); color: #fff; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.me img { width: 32px; height: 32px; border-radius: 50%; }
.me a { color: var(--muted); font-size: 12px; display: block; }

main { padding: 28px 32px; width: 100%; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-content: start; align-items: start; }
main > h1, main > p, main > .full { grid-column: 1 / -1; }
main > h1 { margin: 0; }
main > p { margin: 0; }
main > .card { margin-bottom: 0; }
@media (max-width: 1100px) { main { grid-template-columns: minmax(0, 1fr); } }
h1 { margin: 0 0 20px; font-size: 22px; }
h2 { margin: 0 0 12px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat { background: var(--panel2); border-radius: 10px; padding: 14px; }
.stat small { color: var(--muted); display: block; }
.stat strong { font-size: 20px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--panel2); font-size: 12px; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.online::before { background: var(--ok); } .pill.connecting::before { background: var(--warn); } .pill.error::before { background: var(--bad); }

.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--border); padding: 8px 14px; border-radius: 8px; font: inherit; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { border-color: var(--accent2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { color: var(--bad); border-color: var(--danger-border); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
input[type=text], input[type=number], select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; font: inherit; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; color: var(--text); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); column-gap: 18px; }

.banner-prev { aspect-ratio: 17 / 6; max-width: 520px; width: 100%; border-radius: 10px; background: var(--panel2) center/cover; border: 1px dashed var(--border); margin-bottom: 14px; }
.avatar-prev { width: 80px; height: 80px; border-radius: 50%; background: var(--panel2) center/cover; border: 1px dashed var(--border); }
.hint { color: var(--muted); font-size: 12px; }

.module { display: grid; gap: 12px; }
.module-head { display: flex; align-items: center; gap: 14px; }
.module-head .ico { width: 46px; height: 46px; border-radius: 12px; background: var(--panel2); color: var(--accent2); display: grid; place-items: center; flex: none; }
.module-head .info { flex: 1; }
.module-head .info p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 99px; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }
.module-body { border-top: 1px solid var(--border); padding-top: 14px; }

.list { display: grid; gap: 8px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel2); border-radius: 8px; padding: 10px 14px; }
.list-item code { color: var(--accent2); }
.err { color: var(--bad); }

.toast { position: fixed; right: 20px; bottom: calc(var(--footer-h) + 16px); background: var(--panel2); border: 1px solid var(--border); border-left: 4px solid var(--ok); padding: 12px 16px; border-radius: 8px; opacity: 0; transform: translateY(10px); transition: .25s; pointer-events: none; max-width: 360px; z-index: 20; }
.toast.show { opacity: 1; transform: none; }
.toast.bad { border-left-color: var(--bad); }

.made-by { position: fixed; left: 0; right: 0; bottom: 0; height: var(--footer-h); background: var(--footer-bg); border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 12px; color: var(--muted); z-index: 10; }
.made-by strong { color: var(--text); font-weight: 600; }
.made-by a { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 100%; color: var(--muted); text-decoration: none; }
.made-by a:hover, .made-by a:hover strong { color: var(--text); }


.icon { flex: none; }
.me .crown { color: var(--warn); margin-left: 6px; vertical-align: -2px; }
.list-item > span { display: inline-flex; align-items: center; gap: 8px; }
.err { display: flex; align-items: center; gap: 8px; }

.progress { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-bottom: 6px; position: relative; }
.progress > div { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .15s; }
.progress.indeterminate > div { width: 35%; position: absolute; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { left: -35%; } to { left: 100%; } }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px; max-width: 100%; max-height: 100%; overflow: auto; }
.modal h2 { color: var(--text); font-size: 17px; text-transform: none; letter-spacing: 0; }
.crop-canvas { display: block; max-width: 100%; border-radius: 8px; cursor: grab; touch-action: none; background: #000; }
.crop-canvas:active { cursor: grabbing; }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* Module: auf-/zuklappen */
.collapse { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.collapse.open { grid-template-rows: 1fr; }
.collapse > div { overflow: hidden; min-height: 0; }
.collapse .module-body { margin-top: 12px; }

/* Musik */
.grow { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 8px; }
.url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now { display: flex; align-items: center; gap: 12px; background: var(--panel2); border-radius: 10px; padding: 12px 14px; margin-top: 10px; color: var(--accent2); }
.now > div { color: var(--text); min-width: 0; }
.seg { display: inline-flex; background: var(--panel2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-btn { background: none; border: 0; color: var(--muted); padding: 7px 14px; border-radius: 8px; font: inherit; cursor: pointer; }
.seg-btn.active { background: var(--accent); color: #fff; }

/* Chat */
main.wide { display: block; padding: 0; }
.chat { display: grid; grid-template-columns: 68px 220px 1fr; height: calc(100vh - var(--footer-h)); height: calc(100dvh - var(--footer-h)); }
.chat-guilds { background: var(--rail-bg); padding: 12px 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; align-items: center; }
.guild-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--panel2); color: var(--text); font: 600 14px system-ui; cursor: pointer; overflow: hidden; padding: 0; transition: border-radius .15s, background .15s; flex: none; }
.guild-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.guild-btn:hover, .guild-btn.active { border-radius: 14px; background: var(--accent); }
.chat-channels { background: var(--panel); overflow-y: auto; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.chat-guild-name { font-weight: 600; padding: 4px 8px 12px; }
.chan-cat { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; padding: 12px 8px 4px; }
.chan { display: flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--muted); padding: 6px 8px; border-radius: 6px; font: inherit; cursor: pointer; text-align: left; }
.chan:hover { background: var(--panel2); color: var(--text); }
.chan.active { background: var(--panel2); color: var(--text); }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 18px; }
.msg { display: flex; gap: 12px; padding: 6px 8px; border-radius: 8px; position: relative; }
.msg:hover { background: var(--panel); }
.msg .av { width: 38px; height: 38px; border-radius: 50%; flex: none; }
.msg-body { min-width: 0; flex: 1; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-head time { color: var(--muted); font-size: 11px; }
.tag { background: var(--accent); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 4px; }
.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg-actions { display: none; position: absolute; right: 8px; top: -10px; gap: 4px; }
.msg:hover .msg-actions { display: flex; }
.msg-actions .btn { padding: 4px 8px; background: var(--panel2); }
.embed { border-left: 4px solid var(--border); background: var(--panel); border-radius: 4px; padding: 8px 12px; margin-top: 6px; max-width: 480px; }
.att { max-width: 320px; max-height: 240px; border-radius: 8px; display: block; margin-top: 6px; }
.crow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cbtn { padding: 5px 14px; border-radius: 4px; font-size: 13px; background: #4e5058; color: #fff; }
.cbtn.primary { background: #5865f2; } .cbtn.success { background: #248046; } .cbtn.danger { background: #da373c; }
.csel { min-width: 260px; padding: 8px 12px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.csel::after { content: "▾"; float: right; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 18px; background: var(--panel); border-top: 1px solid var(--border); color: var(--muted); }
.reply-bar .btn { margin-left: auto; padding: 3px 10px; }
.composer { border-top: 1px solid var(--border); padding: 12px 18px; background: var(--panel); }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input { resize: none; min-height: 42px; max-height: 160px; flex: 1; field-sizing: content; }
.composer-panel { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 10px; max-height: 40vh; overflow-y: auto; }
.builder-list { display: grid; gap: 10px; margin-bottom: 12px; }
.builder-item { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.builder-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.builder-head > span { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.builder-head .btn { padding: 4px 8px; }
.opt-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }
input[type=color] { width: 100%; height: 38px; padding: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }


/* Auditlog */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:hover { background: var(--panel2); }
.nowrap { white-space: nowrap; }
.wrap { word-break: break-word; }
.cat { background: var(--panel2); color: var(--accent2); border-radius: 99px; padding: 2px 10px; font-size: 12px; }

.steps { color: var(--muted); font-size: 13px; padding-left: 20px; margin: 8px 0; display: grid; gap: 4px; }



.steps li { margin-bottom: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 99px; padding: 6px 14px; font: inherit; cursor: pointer; }
.chip:hover { border-color: var(--accent2); }
.chip .icon { color: var(--accent2); }

.lang { display: flex; gap: 4px; justify-content: center; }
.lang button { background: var(--panel2); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 2px 12px; font: 600 12px system-ui, sans-serif; cursor: pointer; }
.lang button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.sidebar .lang { margin-top: auto; }
.sidebar .lang + .me { margin-top: 0; }

/* Karten in zwei unabhängigen Spalten (keine Lücken) */
.mod-cols { display: flex; gap: 18px; align-items: flex-start; }
.mod-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.mod-col .card { margin-bottom: 0; }
@media (max-width: 1100px) { .mod-cols { flex-direction: column; align-items: stretch; } .mod-col { width: 100%; } }

/* Auditlog: Suchfeld mit Filter */
.searchbar { position: relative; flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding-left: 12px; color: var(--muted); }
.searchbar:focus-within { outline: 2px solid var(--accent); border-color: transparent; }
.searchbar input { border: 0; background: none; padding: 9px 0; flex: 1; width: auto; }
.searchbar input:focus { outline: none; }
.icon-btn { position: relative; background: none; border: 0; border-left: 1px solid var(--border); color: var(--muted); padding: 9px 12px; cursor: pointer; display: inline-flex; align-items: center; }
.icon-btn:hover { color: var(--text); }
.icon-btn.active { color: var(--accent); }
.badge { position: absolute; top: 3px; right: 3px; background: var(--accent); color: #fff; border-radius: 99px; font-size: 10px; min-width: 16px; height: 16px; line-height: 16px; text-align: center; }
.filter-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 320px; max-width: 90vw; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; z-index: 30; box-shadow: 0 12px 32px rgba(0,0,0,.55); display: grid; gap: 14px; color: var(--text); }
.ss-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.ss-list { max-height: 150px; overflow-y: auto; margin-top: 6px; display: grid; gap: 2px; }
.ss-item { background: none; border: 0; color: var(--text); text-align: left; padding: 6px 10px; border-radius: 6px; font: inherit; cursor: pointer; }
.ss-item:hover { background: var(--panel2); }
.ss-item.active { background: var(--accent); color: #fff; }

.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 6px; min-width: 180px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.dropdown-menu .btn { width: 100%; white-space: nowrap; }

/* ---- Mobilgeräte ---- */
.chat-chan-select { display: none; }
@media (hover: none) { .msg-actions { display: flex; top: 4px; opacity: .85; } .msg { padding-right: 90px; } }

@media (max-width: 760px) {
  body { padding-bottom: calc(var(--footer-h) + env(safe-area-inset-bottom)); }
  .made-by { height: calc(var(--footer-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
  .app { grid-template-columns: 1fr; }

  /* Kopfleiste: Logo/Sprache/Nutzer oben, Navigation als wischbare Leiste darunter */
  .sidebar { position: sticky; top: 0; z-index: 15; display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "logo lang me" "nav nav nav"; align-items: center;
    gap: 8px 10px; padding: 8px 12px 0; padding-top: calc(8px + env(safe-area-inset-top)); border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .logo { grid-area: logo; font-size: 18px; }
  .sidebar .lang { grid-area: lang; margin: 0; }
  .sidebar .me { grid-area: me; margin: 0; }
  .me > div { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar nav { grid-area: nav; display: flex; gap: 4px; overflow-x: auto; margin: 0 -12px; padding: 0 12px 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  nav button { flex: none; white-space: nowrap; padding: 10px 14px; min-height: 42px; }

  main { padding: 14px 12px; gap: 14px; }
  main.wide { padding: 0; }
  h1 { font-size: 20px; margin-bottom: 14px; }
  .card { padding: 14px; border-radius: 10px; }
  .login-card { padding: 28px 20px; margin: 16px; }
  .logo.big { font-size: 30px; }

  /* Bedienbarkeit per Touch */
  .btn { min-height: 42px; padding: 9px 14px; }
  .chip { min-height: 38px; }
  input[type=text], input[type=number], select, textarea { font-size: 16px; padding: 10px 12px; min-height: 42px; }
  .seg-btn { padding: 9px 14px; }
  .switch { width: 50px; height: 28px; }
  .switch span::after { width: 22px; height: 22px; }
  .switch input:checked + span::after { transform: translateX(22px); }
  .check input { width: 22px; height: 22px; }
  .row { gap: 8px; }
  .row > .btn { flex: 1 1 auto; justify-content: center; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .list-item { flex-wrap: wrap; }
  .module-head { flex-wrap: wrap; gap: 10px; }
  .module-head .info { min-width: 60%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat strong { font-size: 17px; }
  .now { flex-wrap: wrap; }
  .toast { left: 12px; right: 12px; max-width: none; bottom: calc(var(--footer-h) + 12px + env(safe-area-inset-bottom)); }
  .modal { padding: 16px; }
  .modal-bg { padding: 8px; }
  .dropdown-menu { right: auto; left: 0; max-width: 85vw; }
  .filter-pop { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(var(--footer-h) + 12px); width: auto; max-width: none; max-height: 70vh; overflow-y: auto; }
  .searchbar { min-width: 0; flex-basis: 100%; }
  .table th, .table td { padding: 8px; }

  /* Chat: Server-Leiste weg, Channel per Auswahlfeld */
  .chat { grid-template-columns: minmax(0, 1fr); height: calc(100vh - var(--footer-h) - var(--topbar-h, 96px)); height: calc(100dvh - var(--footer-h) - var(--topbar-h, 96px)); }
  .chat-guilds, .chat-channels { display: none; }
  .chat-chan-select { display: block; flex: 1; min-width: 0; }
  .chat-head { padding: 8px 12px; }
  .chat-head > strong { display: none; }
  .chat-msgs { padding: 10px 8px; }
  .msg { gap: 8px; padding-right: 8px; flex-wrap: wrap; }
  .msg .av { width: 32px; height: 32px; }
  .msg-actions { position: static; display: flex; flex-basis: 100%; margin-left: 40px; opacity: 1; }
  .embed, .att { max-width: 100%; }
  .composer { padding: 8px 10px; }
  .composer-row { flex-wrap: wrap; }
  .chat-input { flex-basis: 100%; }
  .composer-row .btn { flex: 1; justify-content: center; }
  .composer-panel { max-height: 45vh; }
  .opt-row { grid-template-columns: 1fr; }
  .csel { min-width: 0; width: 100%; }
}

/* Modul-Übersicht */
.mod-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 18px; align-items: stretch; }
.mod-list > .card { margin-bottom: 0; }
.mod-list .module { grid-template-rows: 1fr auto; }
.mod-list .module-head { align-items: flex-start; }
.mod-list .module .row { align-self: end; }
.mod-list .module-head .switch { margin-top: 2px; }
.searchbar .filter-pop input[type=checkbox] { flex: none; width: 18px; padding: 0; }
.searchbar .filter-pop .check { margin: 0; }
main > .row.full .searchbar { max-width: 420px; }

/* --- Mehrere Bots (neu) --- */
.nav-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; padding: 14px 12px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-card { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; cursor: pointer; font: inherit; text-align: left; }
.bot-card:hover { border-color: var(--accent2); }
.bot-card .gi { width: 48px; height: 48px; border-radius: 50%; background: var(--panel2); object-fit: cover; flex: none; display: grid; place-items: center; font-weight: 600; color: var(--muted); }
.bot-card .meta { min-width: 0; display: grid; gap: 4px; }
.bot-card .meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .me .crown { margin-left: 6px; }
.err.card { color: var(--bad); }
@media (max-width: 760px) { .sidebar .lang { display: none; } }

.nav-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nav-icon { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex: none; }
.nav-icon.ph { display: grid; place-items: center; background: var(--panel2); font-size: 10px; font-weight: 600; text-transform: none; letter-spacing: 0; }

/* --- Mobil-Korrekturen --- */
html, body { overflow-x: hidden; }
.card, .stat, .list-item, .bot-card { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-width: 0; }
  main { min-width: 0; max-width: 100vw; }
  .sidebar nav .nav-label { flex: none; align-self: center; max-width: 160px; padding: 0 8px 0 4px; }
  .sidebar nav .nav-label .nav-name { max-width: 120px; }
  .row[style*="nowrap"] { flex-wrap: wrap !important; }
  .row[style*="nowrap"] > div { min-width: 0; }
  .mod-list { grid-template-columns: minmax(0, 1fr); }
  .table-wrap { margin: 0 -6px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat strong { overflow-wrap: anywhere; }
  .me > div { max-width: 34vw; }
  .module-head .info { min-width: 0; flex: 1 1 60%; }
  .searchbar { flex-basis: 100%; }
  .opt-row { grid-template-columns: minmax(0, 1fr); }
  .modal { width: 100%; }
}
@media (max-width: 760px) { .app { grid-template-rows: auto minmax(0, 1fr); align-content: start; } .sidebar { align-self: start; } }

/* --- Admin-Modal --- */
.admin-btn { padding: 5px 10px; font-size: 12px; margin-top: 6px; }
.me { flex-wrap: wrap; }
.modal.admin { width: min(1120px, 100%); height: min(860px, 100%); display: flex; flex-direction: column; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.admin-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.modal.admin .seg { align-self: flex-start; margin-bottom: 14px; }
main.in-modal { padding: 0; width: 100%; flex: 1; overflow: auto; align-content: start; }
main.in-modal > h1 { display: none; }
details.diag { margin-top: 6px; }
details.diag summary { cursor: pointer; color: var(--muted); font-size: 12px; }
details.diag pre { white-space: pre-wrap; word-break: break-all; font-size: 11px; color: var(--muted); background: var(--panel2); padding: 8px; border-radius: 6px; max-height: 200px; overflow: auto; margin: 6px 0 0; }
.badge-ip { font-family: monospace; }
@media (max-width: 760px) {
  .modal-bg { padding: 0; }
  .modal.admin { width: 100%; height: 100%; border-radius: 0; padding: 14px; }
  .admin-head .btn { padding: 8px 10px; }
  .modal.admin .seg { align-self: stretch; }
  .modal.admin .seg-btn { flex: 1; padding: 9px 6px; }
  .admin-btn span { display: none; }
  .admin-btn { margin: 0; min-height: 36px; }
  .list-item .grow { flex: 1 1 100%; }
  .row[style*="nowrap"] > div { flex: 1 1 100% !important; }
  .row[style*="nowrap"] > .btn { flex: 1 1 100%; }
  .composer-row > .btn { flex: 1 1 30%; }
}
.diagrow { flex-wrap: nowrap; align-items: flex-start; }
.diagrow .icon { margin-top: 3px; }

/* --- Benutzerliste (aufklappbar) --- */
.user-list { display: grid; gap: 10px; }
.user-item { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.user-item.open { border-color: var(--accent2); }
.user-head { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--text); font: inherit; padding: 12px 14px; cursor: pointer; text-align: left; flex-wrap: wrap; }
.user-head:hover { background: var(--panel2); }
.user-head .grow { gap: 10px; flex-wrap: wrap; }
.user-head code { color: var(--accent2); font-size: 12px; }
.user-head .chev { display: inline-flex; transform: rotate(-90deg); transition: transform .2s; color: var(--muted); margin-left: auto; }
.user-item.open .chev { transform: rotate(90deg); }
.user-body { padding: 4px 14px 16px; border-top: 1px solid var(--border); margin-top: 0; padding-top: 14px; }
.addon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 18px; align-items: start; }
.addon-col { display: grid; gap: 5px; align-content: start; min-width: 0; }
.addon-name { font-size: 13px; color: var(--muted); min-height: 1.4em; }
.addon-col select { height: 42px; }
.addon-col .hint { min-height: 2.4em; }
.filter-pop select { width: 100%; }
@media (max-width: 760px) { .user-head .hint.nowrap { margin-left: 0; } .addon-col .hint { min-height: 0; } }

/* --- Benutzerbereich in der Seitenleiste --- */
.sidebar .me { flex-direction: column; align-items: stretch; gap: 10px; margin-top: auto; padding: 12px; background: var(--panel2); border: 1px solid var(--border); border-radius: 12px; }
.me-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me-top img { width: 38px; height: 38px; border-radius: 50%; flex: none; }
.me-name { display: grid; min-width: 0; line-height: 1.25; }
.me-name strong { display: flex; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-name .hint { font-size: 11px; min-height: 0; }
.me-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lang-seg { display: inline-flex; align-items: center; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 2px 2px 2px 8px; color: var(--muted); }
.lang-seg button { background: none; border: 0; color: var(--muted); font: 600 12px system-ui, sans-serif; padding: 4px 9px; border-radius: 6px; cursor: pointer; }
.lang-seg button:hover { color: var(--text); }
.lang-seg button.active { background: var(--accent); color: #fff; }
.sidebar .me .admin-btn { flex: 1 1 100%; justify-content: center; margin: 0; padding: 7px 10px; font-size: 13px; }
.sidebar .me .ghost-btn { flex: 1 1 100%; justify-content: center; margin: 0; padding: 7px 10px; font-size: 13px; color: var(--muted); }
.sidebar .me .ghost-btn:hover { color: var(--bad); border-color: var(--danger-border); }
.sidebar .me .lang-seg { flex: 1 1 100%; justify-content: space-between; }
.sidebar .me .lang-seg .icon { margin-right: 2px; }
.sidebar .me .lang-seg button { flex: 1; }
@media (max-width: 760px) {
  .sidebar .me { flex-direction: row; align-items: center; padding: 4px 6px; gap: 6px; border-radius: 10px; flex-wrap: nowrap; }
  .me-top .me-name { display: none; }
  .me-top img { width: 30px; height: 30px; }
  .me-actions { flex-wrap: nowrap; gap: 6px; }
  .sidebar .me .lang-seg { flex: none; padding-left: 4px; }
  .sidebar .me .lang-seg .icon { display: none; }
  .sidebar .me .admin-btn, .sidebar .me .ghost-btn { flex: none; padding: 6px 9px; min-height: 34px; }
  .sidebar .me .admin-btn span, .sidebar .me .ghost-btn span { display: none; }
  .me > div { max-width: none; }
}

/* Tabellen: nicht zeichenweise umbrechen, auf kleinen Bildschirmen seitlich scrollen */
.table td, .table th { overflow-wrap: normal; word-break: normal; }
.table td.wrap { overflow-wrap: anywhere; min-width: 200px; }
.table { min-width: 640px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* --- Design-Umschalter (oben rechts, auf allen Seiten) --- */
.theme-toggle { position: fixed; top: 12px; right: 14px; z-index: 30; width: 38px; height: 38px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); box-shadow: 0 2px 10px rgba(0,0,0,.25); cursor: pointer; }
.theme-toggle:hover { background: var(--panel2); border-color: var(--accent2); }
.theme-toggle .icon { display: block; }
:root[data-theme="light"] .modal-bg { background: rgba(20, 24, 40, .45); }
:root[data-theme="light"] .toast { box-shadow: 0 6px 20px rgba(0,0,0,.15); }
:root[data-theme="light"] .filter-pop, :root[data-theme="light"] .dropdown-menu { box-shadow: 0 12px 32px rgba(20,24,40,.18); }
:root[data-theme="light"] .theme-toggle { box-shadow: 0 2px 10px rgba(20,24,40,.15); }
:root[data-theme="light"] .pill { background: var(--panel2); }
@media (max-width: 760px) {
  .theme-toggle { top: 8px; right: 8px; width: 36px; height: 36px; }
  .sidebar { padding-right: 52px; }
}
