/* Schriften liegen im Dashboard selbst (fonts/, Lizenz: SIL OFL 1.1); es werden keine Daten an Google übertragen. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/inter.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500 700; font-display: swap; src: url("/fonts/space-grotesk.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 400 500; font-display: swap; src: url("/fonts/geist-mono.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --bg: #0d0f12;
  --bg-sidebar: #101317;
  --surface: #14171c;
  --surface-2: #181c22;
  --surface-3: #232833;
  --border: #23272f;
  --border-strong: #2a2f38;
  --text: #e8eaed;
  --text-muted: #a9b0bb;
  --text-faint: #8a919c;
  --accent: #8b9bff;
  --accent-strong: #7385ff;
  --accent-hover: #aeb8ff;
  --accent-soft: rgb(139 155 255 / 12%);
  --success: #7fd6a6;
  --success-soft: rgb(127 214 166 / 10%);
  --warning: #f2b544;
  --warning-soft: rgb(242 181 68 / 10%);
  --danger: #f28b82;
  --danger-soft: rgb(242 139 130 / 10%);
  --danger-text: #ffc4be;
  --on-accent: #0d0f12;
  --border-hover: #3a404b;
  --toast-error-bg: #2b1717;
  --glass: rgb(13 15 18 / 85%);
  --glass-strong: rgb(20 23 28 / 92%);
  --hover-fill: rgb(232 234 237 / 6%);
  --overlay: rgb(5 6 8 / 70%);
  --shadow: rgb(0 0 0 / 60%);
  --radius: 16px;
  --radius-small: 10px;
  --sidebar-width: 252px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
  --display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, Consolas, monospace;
}

/* Hell-Modus: per Systemeinstellung oder über den Umschalter (data-theme an <html>). */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f5f6f8;
    --bg-sidebar: #ffffff;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --surface-3: #e4e7ec;
    --border: rgb(17 19 24 / 10%);
    --border-strong: rgb(17 19 24 / 16%);
    --border-hover: rgb(17 19 24 / 28%);
    --text: #14161a;
    --text-muted: #545b66;
    --text-faint: #6b7280;
    --accent: #4954d6;
    --accent-strong: #3c47c4;
    --accent-hover: #3a44b8;
    --accent-soft: rgb(73 84 214 / 10%);
    --on-accent: #ffffff;
    --success: #0f7a4b;
    --success-soft: rgb(15 122 75 / 9%);
    --warning: #9a5b00;
    --warning-soft: rgb(154 91 0 / 9%);
    --danger: #c0352b;
    --danger-soft: rgb(192 53 43 / 8%);
    --danger-text: #a12a21;
    --toast-error-bg: #fdecea;
    --glass: rgb(245 246 248 / 85%);
    --glass-strong: rgb(255 255 255 / 92%);
    --hover-fill: rgb(17 19 24 / 5%);
    --overlay: rgb(17 19 24 / 35%);
    --shadow: rgb(17 19 24 / 18%);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --bg-sidebar: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e4e7ec;
  --border: rgb(17 19 24 / 10%);
  --border-strong: rgb(17 19 24 / 16%);
  --border-hover: rgb(17 19 24 / 28%);
  --text: #14161a;
  --text-muted: #545b66;
  --text-faint: #6b7280;
  --accent: #4954d6;
  --accent-strong: #3c47c4;
  --accent-hover: #3a44b8;
  --accent-soft: rgb(73 84 214 / 10%);
  --on-accent: #ffffff;
  --success: #0f7a4b;
  --success-soft: rgb(15 122 75 / 9%);
  --warning: #9a5b00;
  --warning-soft: rgb(154 91 0 / 9%);
  --danger: #c0352b;
  --danger-soft: rgb(192 53 43 / 8%);
  --danger-text: #a12a21;
  --toast-error-bg: #fdecea;
  --glass: rgb(245 246 248 / 85%);
  --glass-strong: rgb(255 255 255 / 92%);
  --hover-fill: rgb(17 19 24 / 5%);
  --overlay: rgb(17 19 24 / 35%);
  --shadow: rgb(17 19 24 / 18%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgb(139 155 255 / 35%); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Grundbausteine */

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; text-decoration: none; }
.brand-mark { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; background: var(--accent); color: var(--on-accent); font: 700 17px/1 var(--display); }

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.button:disabled { cursor: default; opacity: .4; }
.button-primary { background: var(--accent); color: var(--on-accent); }
.button-primary:not(:disabled):hover { background: var(--accent-hover); }
.button-ghost { border-color: var(--border-strong); background: var(--surface); color: var(--text); font-weight: 500; }
.button-ghost:not(:disabled):hover { border-color: rgb(139 155 255 / 45%); background: var(--accent-soft); }
.button-danger { border-color: rgb(242 139 130 / 45%); background: var(--danger-soft); color: var(--danger-text); }
.button-danger:not(:disabled):hover { border-color: var(--danger); background: rgb(242 139 130 / 18%); }
.button-small { min-height: 34px; padding: 0 12px; border-radius: 8px; font-size: 13px; }
.button-block { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }

.icon-button { display: inline-grid; width: 36px; height: 36px; place-items: center; padding: 0; border: 0; border-radius: var(--radius-small); background: transparent; color: var(--text-muted); transition: background .15s, color .15s; }
.icon-button:hover { background: var(--surface-3); color: var(--text); }
.icon-button.danger:hover { background: var(--danger-soft); color: var(--danger); }

.link { color: var(--accent); font-size: 13px; font-weight: 500; text-decoration: none; }
.link:hover { color: var(--accent-hover); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text-muted); font: 500 11px/1.5 var(--mono); letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.badge::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.badge.success { border-color: rgb(127 214 166 / 28%); background: var(--success-soft); color: var(--success); }
.badge.warning { border-color: rgb(242 181 68 / 28%); background: var(--warning-soft); color: var(--warning); }
.badge.danger { border-color: rgb(242 139 130 / 30%); background: var(--danger-soft); color: var(--danger); }
.badge.neutral::before { display: none; }

.alert { padding: 12px 14px; border-radius: var(--radius-small); font-size: 13px; }
.alert-error { border: 1px solid rgb(242 139 130 / 28%); background: var(--danger-soft); color: var(--danger-text); }

.empty-text { padding: 32px 20px; color: var(--text-faint); font-size: 13px; text-align: center; }
.hint { color: var(--text-faint); font-size: 12px; }
.hint-list { display: grid; gap: 8px; margin: 0; padding-left: 20px; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.count { margin-left: 6px; color: var(--text-faint); font: 500 12px var(--mono); }

/* Anmeldung, Laden, leerer Zustand */

.auth-screen { display: grid; min-height: 100vh; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-card { display: grid; width: min(420px, 100%); gap: 18px; padding: 36px; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--glass-strong); box-shadow: 0 40px 100px -30px var(--shadow); backdrop-filter: blur(12px); }
.auth-card .brand { margin-bottom: 12px; }
.auth-card h1 { font: 600 36px/1.1 var(--display); letter-spacing: -.025em; }
.auth-text { color: var(--text-muted); }
.auth-note { color: var(--text-faint); font-size: 12px; text-align: center; }
.reason-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.reason-list li { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--surface-2); color: var(--text-muted); font-size: 13px; }
.reason-list strong { color: var(--text); font-weight: 600; }
.spinner { width: 26px; height: 26px; border: 2px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* App-Rahmen */

.shell { display: grid; min-height: 100vh; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; gap: 22px; padding: 22px 14px 14px; border-right: 1px solid var(--border); background: var(--bg-sidebar); }
.sidebar > .brand { padding: 0 8px; }
.guild-picker { position: relative; }
.guild-button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-small); background: var(--surface); text-align: left; transition: border-color .15s; }
.guild-button:hover, .guild-button[aria-expanded="true"] { border-color: rgb(139 155 255 / 40%); }
.guild-icon { display: grid; width: 32px; height: 32px; flex: none; place-items: center; overflow: hidden; border-radius: 9px; background: var(--surface-3); color: var(--text-muted); font-size: 12px; font-weight: 600; }
.guild-icon img { width: 100%; height: 100%; object-fit: cover; }
.guild-text { display: grid; min-width: 0; flex: 1; }
.guild-text strong { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.guild-text small { color: var(--text-faint); font-size: 11px; }
.guild-chevron { color: var(--text-faint); }
.guild-menu { position: absolute; top: calc(100% + 6px); right: 0; left: 0; z-index: 40; display: grid; max-height: min(360px, 60vh); gap: 2px; margin: 0; padding: 6px; overflow-y: auto; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); box-shadow: 0 24px 50px -16px var(--shadow); list-style: none; }
.guild-option { display: flex; width: 100%; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.guild-option:hover, .guild-option:focus-visible { background: var(--surface-2); }
.guild-option[aria-current="true"] { background: var(--accent-soft); }
.guild-option .guild-icon { width: 28px; height: 28px; }
.nav { display: grid; gap: 2px; overflow-y: auto; }
.nav-group { margin: 14px 12px 4px; color: var(--text-faint); font: 500 10.5px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.nav-link { position: relative; display: flex; min-height: 42px; align-items: center; gap: 12px; padding: 0 12px; border-radius: var(--radius-small); color: var(--text-muted); font-weight: 500; text-decoration: none; transition: background .15s, color .15s; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.nav-link[aria-current="page"] .icon { color: var(--accent); }
.nav-link.alert::after { width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); content: ""; }
.sidebar-footer { display: grid; gap: 10px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.theme-button { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: var(--radius-small); background: transparent; color: var(--text-muted); font-size: 12px; text-align: left; }
.theme-button:hover { background: var(--surface-2); color: var(--text); }
.user { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.avatar { width: 30px; height: 30px; flex: none; border-radius: 50%; object-fit: cover; }
.avatar-fallback { display: grid; place-items: center; background: var(--surface-3); font-size: 13px; font-weight: 600; }
.user-name { min-width: 0; flex: 1; overflow: hidden; font-size: 13px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-backdrop { display: none; }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; min-height: 84px; align-items: center; gap: 12px; padding: 14px 40px; border-bottom: 1px solid var(--border); background: var(--glass); backdrop-filter: blur(14px); }
.menu-button { display: none; }
.topbar-title { min-width: 0; flex: 1; }
.topbar-server { display: block; overflow: hidden; color: var(--text-faint); font: 500 11px/1.6 var(--mono); letter-spacing: .06em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.topbar-title h1 { font: 600 28px/1.15 var(--display); letter-spacing: -.02em; }
.topbar-description { margin-top: 2px; overflow: hidden; color: var(--text-muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
#discord-status { cursor: help; }

.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px 40px 56px; }
.page { display: grid; gap: 20px; animation: fade-in .25s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }

/* Karten und Raster */

.card { display: grid; align-content: start; gap: 20px; min-width: 0; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.card-flush { gap: 0; padding: 0; overflow: hidden; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-header h2, .toolbar-title { font: 600 20px/1.25 var(--display); letter-spacing: -.01em; }
.card-subtitle { margin-top: 4px; color: var(--text-muted); font-size: 13px; }
.card-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; border-top: 1px solid var(--border); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 20px; }

/* Kennzahlen als durchgehende Leiste mit Haarlinien */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { display: grid; gap: 8px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.stat-label { color: var(--text-muted); font-size: 13px; }
.stat-value { font: 600 32px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-hint { color: var(--text-faint); font-size: 12px; }

.trend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px 32px; }
.trend { display: grid; gap: 6px; min-width: 0; }
.trend-figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.trend-value { font: 600 28px/1.1 var(--display); }
.trend-delta { color: var(--text-muted); font-size: 12px; }
.trend-chart { display: block; width: 100%; height: auto; margin-top: 6px; overflow: visible; }
.trend-chart .bar { fill: var(--accent); opacity: .38; }
.trend-chart .bar.recent { opacity: 1; }
.trend-chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.trend-chart .hit { fill: transparent; cursor: default; }
.trend-chart .hit:hover, .trend-chart .hit.active { fill: var(--hover-fill); }
.trend-axis { display: flex; justify-content: space-between; gap: 8px; color: var(--text-faint); font: 11px var(--mono); }
.chart-tooltip { position: fixed; z-index: 50; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 12px; white-space: nowrap; pointer-events: none; box-shadow: 0 12px 30px -12px rgb(0 0 0 / 60%); }
.chart-tooltip strong { font-weight: 600; }
.activity-list, .status-list, .type-list { display: grid; margin: 0; padding: 0; list-style: none; }
.activity-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.activity-list li:first-child { border-top: 0; padding-top: 0; }
.activity-action { font-weight: 500; }
.activity-time { color: var(--text-faint); font: 12px var(--mono); white-space: nowrap; }
.activity-detail { grid-column: 1 / -1; overflow: hidden; color: var(--text-muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.status-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.status-list li:first-child { border-top: 0; padding-top: 0; }
.status-list a { color: var(--text); text-decoration: none; }
.status-list a:hover { color: var(--accent); }

/* Formulare */

.settings-narrow { max-width: 680px; }
.field { display: grid; align-content: start; gap: 7px; min-width: 0; margin: 0; padding: 0; border: 0; }
.label { color: var(--text); font-size: 13px; font-weight: 500; }
legend.label { margin-bottom: 7px; padding: 0; }
.field input, .field select, .toolbar select, .search input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder, .search input::placeholder, .field textarea::placeholder { color: var(--text-faint); }
.field input:hover, .field select:hover, .toolbar select:hover, .search input:hover, .field textarea:hover { border-color: var(--border-hover); }
.field input:focus, .field select:focus, .toolbar select:focus, .search input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[inputmode="numeric"], .field input[type="number"] { font-family: var(--mono); font-size: 13px; }
.field .hint { order: 3; }
.field-row { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; }
.field-emoji input { font-size: 18px; text-align: center; }
select option { background: var(--surface-2); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--bg); cursor: pointer; transition: border-color .15s; }
.switch-row:hover { border-color: var(--border-strong); }
.switch-row span { display: grid; gap: 2px; }
.switch-row strong { font-size: 14px; font-weight: 500; }
.switch-row small { color: var(--text-muted); font-size: 12px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; margin: 0; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-3); cursor: pointer; appearance: none; transition: background .15s, border-color .15s; }
.switch::after { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted); content: ""; transition: transform .15s, background .15s; }
.switch:checked { border-color: var(--accent); background: var(--accent); }
.switch:checked::after { background: #fff; transform: translateX(16px); }

.form-footer { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding-top: 18px; border-top: 1px solid var(--border); }
.save-status { color: var(--text-muted); font-size: 13px; }
.save-status.dirty { color: var(--warning); }
.save-status.error { color: var(--danger); }

/* Tabellen */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.toolbar select { width: auto; min-width: 200px; }
.toolbar-sub { padding-top: 14px; padding-bottom: 14px; }
.date-filter { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; }
.date-filter input { min-height: 40px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-small); background: var(--bg); }
.date-filter input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.search { display: flex; flex: 1; gap: 8px; min-width: 240px; }
.toolbar-title { flex: 1; }
.toolbar-count { color: var(--text-faint); font: 12px var(--mono); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 24px; border-bottom: 1px solid var(--border); color: var(--text-faint); font: 500 11px var(--mono); letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 14px 24px; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 13px; vertical-align: top; }
td:first-child { color: var(--text); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: rgb(139 155 255 / 3%); }
.skeleton-row:hover td { background: none; }
.skeleton { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton-row:nth-child(2) .skeleton { width: 82%; }
.skeleton-row:nth-child(3) .skeleton { width: 64%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Nachrichten-Editor mit Discord-Vorschau */
.welcome-form { display: grid; gap: 20px; }
.message-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 24px; }
.editor-fields { display: grid; gap: 14px; min-width: 0; }
.editor-fields .field textarea { min-height: 0; }
.editor-fields input[type=color] { width: 100%; height: 40px; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--radius-small); background: var(--bg); }
.editor-preview { position: sticky; top: 100px; display: grid; gap: 8px; min-width: 0; }
.counted { display: grid; gap: 4px; }
.counter { justify-self: end; color: var(--text-faint); font: 11px var(--mono); }
.counter.near { color: var(--warning); }
.placeholder-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip-button { padding: 3px 9px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-2); font: 12px var(--mono); }
.chip-button:hover { border-color: rgb(139 155 255 / 45%); color: var(--accent); }
.switch-row.compact { padding: 10px 12px; }
.default-note { padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-small); }
/* Die Vorschau zeigt Discords dunkles Design, unabhängig vom Dashboard-Farbmodus. */
.dc-preview { display: flex; gap: 14px; padding: 16px; border-radius: var(--radius-small); background: #313338; color: #dbdee1; font: 15px/1.375 "gg sans", "Segoe UI", system-ui, sans-serif; }
.dc-avatar { display: grid; width: 40px; height: 40px; flex: none; place-items: center; border-radius: 50%; background: #8b9bff; color: #0d0f12; font: 700 18px var(--display); }
.dc-message { min-width: 0; flex: 1; }
.dc-header { display: flex; align-items: center; gap: 6px; }
.dc-header strong { color: #f2f3f5; font-weight: 600; }
.dc-bot { padding: 0 5px; border-radius: 4px; background: #5865f2; color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; text-transform: uppercase; }
.dc-time { color: #949ba4; font-size: 12px; }
.dc-body { display: grid; gap: 6px; margin-top: 2px; }
.dc-content { white-space: pre-wrap; overflow-wrap: anywhere; }
.dc-empty { color: #949ba4; font-style: italic; }
.dc-mention { padding: 0 2px; border-radius: 3px; background: rgb(88 101 242 / 30%); color: #c9cdfb; }
.dc-embed { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; max-width: 432px; padding: 10px 16px 14px 12px; border-left: 4px solid var(--embed-color, #8b5cf6); border-radius: 4px; background: #2b2d31; }
.dc-embed-main { display: grid; gap: 6px; min-width: 0; }
.dc-embed-title { color: #f2f3f5; font-weight: 600; overflow-wrap: anywhere; }
.dc-embed-description { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dc-embed-thumb { width: 80px; height: 80px; border-radius: 4px; object-fit: cover; }
.dc-embed-image { grid-column: 1 / -1; max-width: 100%; border-radius: 4px; }
.dc-embed-footer { grid-column: 1 / -1; color: #b5bac1; font-size: 12px; }

.sent-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.sent-item:first-child { border-top: 0; padding-top: 0; }
.sent-body { display: grid; min-width: 0; flex: 1; gap: 4px; }
.sent-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sent-title strong { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.sent-meta { color: var(--text-muted); font-size: 12px; }

/* Selbstrollen */
.role-rows { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.role-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.role-row input, .role-row select { width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-small); background: var(--bg); }
.role-row .role-emoji { text-align: center; }
.role-row .icon-button { width: 30px; height: 30px; }
.role-add { justify-self: start; }
.empty-state { padding: 28px 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius-small); color: var(--text-muted); font-size: 13px; text-align: center; }
.dc-container { display: grid; gap: 8px; width: 100%; padding: 14px 16px; border-left: 4px solid #8b5cf6; border-radius: 6px; background: #2b2d31; }
.dc-container-title { color: #f2f3f5; font-size: 16px; }
.dc-container p { font-size: 14px; white-space: pre-wrap; }
.dc-container small { color: #949ba4; font-size: 12px; }
.dc-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.dc-button { padding: 6px 14px; border-radius: 4px; background: #4e5058; color: #fff; font-size: 14px; font-weight: 500; }
.dc-select { display: flex; justify-content: space-between; padding: 9px 12px; border: 1px solid #1e1f22; border-radius: 4px; background: #1e1f22; color: #949ba4; font-size: 14px; }
@media (max-width: 640px) {
  .role-row { grid-template-columns: 52px minmax(0, 1fr); }
  .role-row > input:not(.role-emoji) { grid-column: 1 / -1; }
  .role-row .type-actions { grid-column: 1 / -1; justify-self: end; }
}

/* Einrichtungs-Checkliste */
.setup-card { gap: 16px; border-color: rgb(139 155 255 / 28%); background: var(--surface); }
.progress { height: 6px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s ease; }
.setup-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.setup-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--surface); font-size: 13px; text-decoration: none; }
a.setup-item:hover { border-color: rgb(139 155 255 / 40%); }
.setup-item .check { display: grid; width: 20px; height: 20px; flex: none; place-items: center; border: 1.5px solid var(--border-strong); border-radius: 50%; }
.setup-item.done { color: var(--text-muted); }
.setup-item.done .check { border-color: var(--success); background: var(--success); color: var(--surface); }
.setup-item .check .icon { width: 12px; height: 12px; stroke-width: 3; }
.setup-item .go { margin-left: auto; color: var(--accent); font-weight: 500; white-space: nowrap; }
.cell-main { display: block; }
.cell-sub { display: block; margin-top: 2px; color: var(--text-faint); font-size: 12px; font-weight: 400; }
.user-ref { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; vertical-align: bottom; cursor: pointer; }
.user-ref:hover span, .user-ref:focus-visible span { text-decoration: underline; text-underline-offset: 3px; }
.user-ref img { width: 18px; height: 18px; flex: none; border-radius: 50%; object-fit: cover; }
.user-ref span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-ref.left { color: var(--text-muted); }
.user-ref.left img { opacity: .55; }
.cell-nowrap { white-space: nowrap; }
.table-link { color: var(--accent); font-weight: 500; text-decoration: none; white-space: nowrap; }
.table-link:hover { color: var(--accent-hover); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--border); color: var(--text-faint); font: 12px var(--mono); }
.pagination .button { font-family: var(--font); }
.tabs { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.tabs button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--surface-3); color: var(--text); }

/* Ticket-Kategorien */

.type-list { gap: 8px; }
.type-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--bg); }
.type-emoji { display: grid; width: 36px; height: 36px; flex: none; place-items: center; border-radius: 9px; background: var(--surface-3); font-size: 18px; }
.type-body { display: grid; min-width: 0; flex: 1; gap: 2px; }
.type-body strong { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.type-meta { overflow: hidden; color: var(--text-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.type-actions { display: flex; }
.type-actions .icon-button { width: 32px; height: 32px; }
.role-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.role-chip { --role-color: var(--text-faint); display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 9px; overflow: hidden; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.role-chip::before { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--role-color); content: ""; }
.role-chip.muted { color: var(--text-muted); }
.role-chip.muted::before { display: none; }

.role-options { display: flex; flex-wrap: wrap; gap: 6px; max-height: 200px; overflow-y: auto; }
.role-option { --role-color: var(--text-faint); position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 10px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s; }
.role-option::before { width: 8px; height: 8px; border-radius: 50%; background: var(--role-color); content: ""; }
.role-option input { position: absolute; opacity: 0; pointer-events: none; }
.role-option:hover { background: var(--surface-2); }
.role-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.role-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Mehrfachauswahl */

.multi-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.multi-chips:empty { display: none; }
.chip { --role-color: var(--text-faint); display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 4px 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: 13px; }
.chip::before { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--role-color); content: ""; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { display: grid; width: 20px; height: 20px; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); font-size: 14px; line-height: 1; }
.chip button:hover { background: var(--surface-3); color: var(--text); }
.field .multi-chips { order: 2; }

/* Anti-Raid */

.antiraid-form { display: grid; gap: 20px; }
.sticky-footer { position: sticky; bottom: 16px; z-index: 4; padding: 12px 16px 12px 24px; border-color: var(--border-strong); background: var(--glass-strong); box-shadow: 0 20px 50px -10px var(--shadow); backdrop-filter: blur(12px); }
.sticky-footer .form-footer { padding-top: 0; border-top: 0; }
.raid-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 18px 24px; border: 1px solid rgb(242 139 130 / 35%); border-radius: var(--radius); background: var(--danger-soft); }
.raid-banner strong { color: var(--danger-text); font: 600 20px var(--display); }
.raid-banner p { margin-top: 2px; color: var(--text); font-size: 13px; }
.raid-banner code, .hint code, .switch-row code { padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); font-family: var(--mono); font-size: 12px; }
.threshold-table { display: grid; grid-template-columns: minmax(0, 1fr) 90px 110px; align-items: center; gap: 10px 12px; }
.threshold-head { color: var(--text-faint); font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.threshold-name { display: grid; font-weight: 500; }
.threshold-name small { color: var(--text-faint); font-size: 12px; font-weight: 400; }
.threshold-table input, .inline-number { width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-small); background: var(--bg); font-family: var(--mono); font-size: 13px; }
.threshold-table input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.threshold-table .inline-number { width: 64px; min-height: 26px; margin: 2px 2px 0; padding: 0 6px; }

/* KI-Moderation */

.automod-form { display: grid; gap: 20px; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field textarea { width: 100%; min-height: 140px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-small); background: var(--bg); line-height: 1.55; resize: vertical; font: inherit; transition: border-color .15s, box-shadow .15s; }
.field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.footer-note { margin-right: auto; }
.category-table { display: grid; gap: 8px; }
.category-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 190px); align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--bg); }
.category-row label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.category-row label span { display: grid; gap: 1px; }
.category-row strong { font-size: 14px; font-weight: 500; }
.category-row small { color: var(--text-muted); font-size: 12px; }
.category-row select { width: 100%; min-height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-small); background: var(--surface); }
.category-row select:disabled { opacity: .4; }
.cell-quote { max-width: 280px; color: var(--text-muted); font-style: italic; overflow-wrap: anywhere; }
@media (max-width: 800px) {
  .stats-3 { grid-template-columns: minmax(0, 1fr); }
  .category-row { grid-template-columns: minmax(0, 1fr); }
  .footer-note { display: none; }
}

/* Dialog und Toast */

.dialog { width: min(540px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: 0 40px 100px -20px rgb(0 0 0 / 70%); }
.dialog::backdrop { background: var(--overlay); backdrop-filter: blur(4px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.dialog-header h2 { font: 600 22px/1.2 var(--display); letter-spacing: -.01em; }
.dialog-body { display: grid; gap: 16px; padding: 24px; }
.dialog-wide { width: min(720px, calc(100vw - 32px)); }
.member-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.member-head .avatar { width: 44px; height: 44px; }
.member-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.member-stat { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.member-stat strong { font-size: 20px; font-weight: 600; }
.member-stat span { color: var(--text-muted); font-size: 12px; }
.member-section-title { margin-bottom: 8px; color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--border); }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; max-width: min(400px, calc(100vw - 40px)); pointer-events: none; }
.toast { padding: 12px 16px; border: 1px solid var(--border-strong); border-left: 2px solid var(--accent); border-radius: var(--radius-small); background: var(--surface-3); box-shadow: 0 20px 40px -10px var(--shadow); font-size: 13px; pointer-events: auto; animation: toast-in .2s ease-out; transition: opacity .2s, transform .2s; }
.toast.leaving { opacity: 0; transform: translateY(8px); }
.toast.error { border-color: rgb(242 139 130 / 40%); border-left-color: var(--danger); background: var(--toast-error-bg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Responsiv */

@media (max-width: 1080px) {
  .message-editor { grid-template-columns: minmax(0, 1fr); }
  .editor-preview { position: static; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 800px) {
  .shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(280px, 85vw); background: var(--surface); transform: translateX(-100%); transition: transform .2s ease; }
  .shell.menu-open .sidebar { transform: none; box-shadow: 0 0 60px var(--shadow); }
  .shell.menu-open .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; display: block; background: var(--overlay); }
  .nav-link[aria-current="page"]::before { display: none; }
  .menu-button { display: inline-grid; margin-left: -8px; }
  .topbar { min-height: 68px; padding: 10px 16px; }
  .topbar-title h1 { font-size: 22px; }
  .content { padding: 20px 16px 40px; }
  .toolbar { padding: 14px 16px; }
  .toolbar select, .search { width: 100%; min-width: 0; }
  .search { flex: 1 1 100%; }
  .date-filter { flex: 1 1 160px; }
  .date-filter input { min-width: 0; flex: 1; }
  th, td { padding-right: 16px; padding-left: 16px; }
  .pagination { padding: 12px 16px; }
  .card { padding: 18px 16px; }
  .card-flush { padding: 0; }
  .sticky-footer { padding: 10px 12px 10px 16px; }
}

/* Tabellen auf schmalen Bildschirmen: jede Zeile als Karte, Spaltennamen aus data-label */
@media (max-width: 720px) {
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-wrap tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table-wrap td { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; padding: 4px 0; border: 0; }
  .table-wrap td::before { color: var(--text-faint); font: 500 10.5px/1.9 var(--mono); letter-spacing: .06em; text-transform: uppercase; content: attr(data-label); }
  .table-wrap td[colspan] { display: block; }
  .table-wrap td[colspan]::before { content: none; }
  .table-wrap td:empty { display: none; }
  .topbar-description { display: none; }
}

@media (max-width: 480px) {
  .stat { padding: 16px; }
  .stat-value { font-size: 28px; }
  #discord-status { display: none; }
  .auth-card { padding: 26px 22px; }
  .auth-card h1 { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
