/* ============================================================
   Bot Console – helles, aufgeräumtes Dashboard mit Seitenleiste
   ============================================================ */

:root {
  --bg:          #F4F5F8;
  --sidebar:     #FFFFFF;
  --surface:     #FFFFFF;
  --surface-2:   #F1F2F6;
  --border:      #E6E8EE;
  --border-soft: #EEF0F5;

  --text:        #1B1C24;
  --text-dim:    #616675;
  --text-faint:  #9A9FAD;

  --accent:      #0D9488;
  --accent-hover:#0B7D72;
  --accent-soft: #D8F0EC;
  --mint:        #16A34A;
  --danger:      #E5484D;

  --radius:      14px;
  --radius-sm:   9px;
  --shadow-sm:   0 1px 2px rgba(20,22,40,.05);
  --shadow:      0 1px 3px rgba(20,22,40,.06), 0 10px 28px -14px rgba(20,22,40,.14);

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  --sidebar-w: 288px;
}

:root[data-theme="dark"] {
  --bg:          #0F1117;
  --sidebar:     #161A22;
  --surface:     #171B24;
  --surface-2:   #1F242E;
  --border:      #2B313C;
  --border-soft: #232833;
  --text:        #ECEEF3;
  --text-dim:    #9AA1AE;
  --text-faint:  #6C7280;
  --accent:      #17BFAD;
  --accent-hover:#2DD4BF;
  --accent-soft: #123330;
  --mint:        #22C55E;
  --danger:      #F1707A;
  --shadow-sm:   0 1px 2px rgba(0,0,0,.40);
  --shadow:      0 1px 3px rgba(0,0,0,.45), 0 12px 30px -14px rgba(0,0,0,.65);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 15px; line-height: 1.55;
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; margin: 0; }
a { color: inherit; text-decoration: none; }

.container { max-width: 940px; margin: 0 auto; padding: 28px 24px 80px; }

/* ---------- Top-Leiste (Login/Server-Liste) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; background: var(--sidebar); border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 12px; transition: border-color .15s ease;
}
.brand:hover { border-color: var(--accent); }
.brand-mark { color: var(--accent); font-size: 20px; }
.user { display: flex; align-items: center; gap: 12px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); }
.user-name { color: var(--text-dim); font-size: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px; justify-content: center;
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 18px; cursor: pointer; transition: transform .12s ease, background .18s ease, border-color .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-lg { padding: 14px 26px; font-size: 15px; border-radius: 12px; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-ghost { color: var(--text-dim); background: transparent; }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-outline { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Login / Hero ---------- */
.hero { max-width: 540px; margin: 12vh auto 0; text-align: center; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: var(--accent); margin: 0 0 22px; }
.hero-title { font-size: clamp(38px, 7vw, 56px); line-height: 1.03; }
.hero-sub { color: var(--text-dim); font-size: 17px; margin: 22px auto 34px; max-width: 430px; }
.hero-foot { color: var(--text-faint); font-size: 13px; margin-top: 22px; }
.form-error { color: var(--danger); font-size: 14px; margin-top: 18px; }

/* ---------- Seitenkopf (Server-Liste) ---------- */
.page-head { margin: 8px 0 22px; }
.page-head.sub { margin-top: 48px; }
.page-head h1 { font-size: 30px; }
.page-head h2 { font-size: 20px; }
.page-sub { color: var(--text-dim); margin: 6px 0 0; }

/* ---------- Server-Karten ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  position: relative; display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
  transition: transform .14s ease, border-color .18s ease, box-shadow .18s ease;
}
a.card.server:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.card.muted { opacity: .85; }
.presence { position: absolute; top: 14px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.server-icon { width: 46px; height: 46px; border-radius: 13px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); }
.mono-mark { display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--accent); background: var(--accent-soft); }
.server-icon.lg { width: 56px; height: 56px; border-radius: 15px; }
.server-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.server-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-id { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.card-action { color: var(--text-dim); font-size: 13px; font-weight: 600; white-space: nowrap; }
a.card.server:hover .card-action { color: var(--accent); }
.empty { border: 1px dashed var(--border); border-radius: var(--radius); padding: 34px; text-align: center; color: var(--text-dim); background: var(--surface); }

/* ============================================================
   Dashboard mit Seitenleiste (Einstellungsseite)
   ============================================================ */
.dash { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--border);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 0 8px; }

.side-server { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.side-server-meta { display: flex; flex-direction: column; min-width: 0; }
.side-back { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.side-back:hover { color: var(--accent); }

.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--text-dim);
  background: none; border: none; border-radius: var(--radius-sm);
  padding: 10px 12px; cursor: pointer; transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; }
.nav-item.active .nav-dot { opacity: 1; }
.nav-soon { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); padding: 16px 12px 6px; }
.nav-item.disabled { color: var(--text-faint); cursor: default; }
.nav-item.disabled:hover { background: none; }

.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--border-soft); }
.side-user .user-name { font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-logout { font-size: 13px; color: var(--text-dim); }
.side-logout:hover { color: var(--danger); }

.content { padding: 34px 40px 80px; max-width: 1080px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }
.view-title { font-size: 28px; margin-bottom: 22px; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.panel-head { margin-bottom: 18px; }
.panel-head h2 { font-size: 17px; }
.panel-sub { color: var(--text-dim); font-size: 14px; margin: 5px 0 0; }

/* Segmentierte Auswahl (Sprache / Mute-Methode) */
.lang-form { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 4px; gap: 4px; }
.seg { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--text-dim); transition: background .16s ease, color .16s ease; }
.seg:hover span { color: var(--text); }
.seg input:checked + span { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

/* Formularfelder */
.stack { display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.field { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 440px; }
.field-label { font-size: 14px; font-weight: 500; color: var(--text-dim); }
.field-note { color: var(--text-faint); font-weight: 400; }
.hint { color: var(--text-faint); font-size: 13px; margin: 4px 0 0; }

.select, .select-sm {
  appearance: none; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 34px 10px 14px; font: inherit; font-size: 14px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
                    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: right 16px center, right 11px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.select { width: 100%; }
.select:focus, .select-sm:focus, .input-sm:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Eskalations-Tabelle */
.rules { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.rules th { text-align: left; font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); padding: 0 12px 10px; border-bottom: 1px solid var(--border); }
.rules td { padding: 12px; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.rules td.right { text-align: right; }
.rules tr:last-child td { border-bottom: none; }
.rules form { margin: 0; }

.rule-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; padding-top: 20px; border-top: 1px solid var(--border); }
.field-inline { display: flex; flex-direction: column; gap: 6px; }
.field-inline > span { font-size: 12px; color: var(--text-faint); }
.input-sm { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; font: inherit; font-size: 14px; width: 90px; }

/* Erfolgsmeldung */
.toast { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent); border-radius: var(--radius-sm); padding: 11px 16px; margin-bottom: 20px; font-size: 14px; font-weight: 500; animation: fade 4.5s ease forwards; }
@keyframes fade { 0%,80% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

/* Fokus für Tastatur */
a:focus-visible, .btn:focus-visible, .nav-item:focus-visible, .seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Responsive: Seitenleiste wird oben zur Leiste */
@media (max-width: 720px) {
  .dash { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
  .side-nav { flex-direction: row; flex-wrap: wrap; flex: 1 0 100%; }
  .side-server { flex: 1; }
  .side-user { border-top: none; flex: 0; }
  .nav-soon, .nav-item.disabled { display: none; }
  .content { padding: 24px 18px 64px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Theme-Umschalter + Kopf-Rechts ---------- */
.topbar-right { display: flex; align-items: center; gap: 14px; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  cursor: pointer; transition: color .15s ease, border-color .15s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
.float-toggle { position: absolute; top: 20px; right: 20px; }
.side-user .theme-toggle { width: 30px; height: 30px; }
.side-user .theme-toggle svg { width: 16px; height: 16px; }

/* ---------- Auto-Moderation ---------- */
.am-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-top: 14px; }
textarea.words {
  width: 100%; min-height: 92px; resize: vertical; margin-top: 8px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; font: inherit; font-size: 14px; line-height: 1.5;
}
textarea.words:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Modul-Schalter ---------- */
.module-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.module-bar .module-label { font-weight: 600; }
.module-bar .module-hint { color: var(--text-dim); font-size: 13px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-slider { position: absolute; inset: 0; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; transition: background .18s ease, border-color .18s ease; }
.switch-slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px;
  background: var(--text-faint); border-radius: 50%; transition: transform .18s ease, background .18s ease; }
.switch input:checked + .switch-slider { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); background: var(--accent); }
.switch input:focus-visible + .switch-slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-off { margin-left: auto; font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); background: var(--surface-2); border-radius: 5px; padding: 2px 6px; }

/* ============================================================
   Panel-Layout v2: Beschreibung rechts, Felder in einer Reihe
   ============================================================ */
:root { --warn: #B45309; --warn-soft: #FBF0E1; }
:root[data-theme="dark"] { --warn: #F59E0B; --warn-soft: #2A2113; }

.content { max-width: 1400px; padding: 34px 48px 80px; }

.panel {
  display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 30px;
  align-items: start; padding: 24px 28px;
}
.panel-main { min-width: 0; }
.panel-main h2 { font-size: 17px; margin-bottom: 16px; }
.panel-aside { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin: 0; padding-top: 4px; }

.controls-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 20px; }
.ctrl { display: flex; flex-direction: column; gap: 6px; }
.ctrl > span { font-size: 12px; color: var(--text-faint); }
.ctrl .select { width: auto; min-width: 190px; }
.ctrl .input-sm { width: 96px; }
.ctrl.grow { flex: 1 1 100%; }
.ctrl.grow textarea.words { max-width: 560px; margin-top: 0; }

/* Modul aus: klar sichtbar */
.module-body--off { opacity: .45; transition: opacity .2s ease; }
.module-bar--off { border-color: var(--warn); background: var(--warn-soft); }
.module-label--off { color: var(--warn); }
.nav-off { color: var(--warn); background: transparent; }

@media (max-width: 900px) {
  .panel { grid-template-columns: 1fr; gap: 16px; }
  .content { max-width: none; padding: 24px 18px 64px; }
}

/* ============================================================
   Einheitliche Feldgrößen über alle Seiten + breitere Beschreibung
   ============================================================ */
.panel { grid-template-columns: minmax(0, 1fr) 300px; }
.panel-aside { padding-top: 2px; }

/* Alle Aktions-/Auswahl-Dropdowns gleich breit, alle Zahlenfelder gleich breit */
.ctrl { gap: 7px; }
.ctrl .select { width: 200px; min-width: 0; }
.ctrl .input-sm { width: 96px; }
.ctrl.grow textarea.words { max-width: 100%; width: 100%; }

/* Moderations-Seite an dieselben Breiten angleichen */
.panel-main .field { max-width: 360px; }
.panel-main .field .select { width: 100%; }

@media (max-width: 900px) {
  .panel { grid-template-columns: 1fr; }
  .ctrl .select { width: 100%; }
}
