/* Design angelehnt an das EasyBot91-Twitch-Dashboard: dunkel, Seitenleiste links, Lila als Akzent */
:root {
  --bg: #0e0e10; --side: #18181b; --panel: #18181b; --panel2: #1f1f23; --border: #2c2c32;
  --text: #efeff1; --muted: #adadb8; --faint: #6f6f7a;
  --accent: #7c3aed; --accent-h: #6d28d9; --accent-soft: rgba(124, 58, 237, .18); --brand: #a970ff;
  --green: #22c55e; --yellow: #f0b232; --red: #ef4444;
  --sidebar-w: 228px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 "Inter", "Segoe UI", system-ui, sans-serif; }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; color: var(--brand); font-size: 12.5px; }
a { color: var(--brand); }

/* ---------- Seitenleiste ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--side); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 12px 0 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 8px; padding: 0 12px 10px; font-weight: 800; font-size: 16.5px; color: var(--brand);
  letter-spacing: -.01em; white-space: nowrap; }
.side-brand .logo { font-size: 20px; line-height: 1; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 9px 6px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; line-height: 1; padding: 5px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: transparent; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.ok { border-color: rgba(34, 197, 94, .45); color: #4ade80; background: rgba(34, 197, 94, .08); }
.pill.warn { border-color: rgba(240, 178, 50, .45); color: var(--yellow); }
.pill.bad { border-color: rgba(239, 68, 68, .45); color: #f87171; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.side-guild { padding: 6px 12px 4px; }
.side-guild label { margin: 4px 0 5px; }
.side-guild select { padding: 7px 8px; font-size: 13px; }
.side-nav { display: flex; flex-direction: column; padding: 4px 0; flex: 1; }
.nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); padding: 14px 12px 6px; }
.side-nav button { display: flex; align-items: center; gap: 11px; margin: 1px 6px; padding: 8px 10px; border-radius: 7px; border: 0; background: none;
  color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; opacity: .88; }
.side-nav button .ico { width: 18px; text-align: center; font-size: 15px; }
.side-nav button:hover { background: var(--panel2); opacity: 1; }
.side-nav button.active { background: var(--accent-soft); font-weight: 600; opacity: 1; }
.user-chip { display: flex; align-items: center; gap: 9px; margin: 8px 8px 0; padding: 9px 8px 0; border-top: 1px solid var(--border); }
.user-chip img { width: 30px; height: 30px; border-radius: 50%; background: var(--panel2); flex: none; }
.user-chip > div { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .muted { font-size: 11.5px; }

.content { flex: 1; min-width: 0; }
main { max-width: 960px; margin: 0 auto; padding: 16px 20px 40px; }
.tab { display: none; }
.tab.active { display: block; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
  .side-nav { flex-direction: row; overflow-x: auto; padding: 4px 6px; }
  .nav-label { display: none; }
  .side-nav button { white-space: nowrap; margin: 0 2px; }
  .user-chip { border-top: 0; padding-top: 4px; }
  main { padding: 14px 16px 32px; }
}

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px 16px 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 13px 15px; }
.stat .label { color: var(--faint); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.stat .value { font-size: 21px; font-weight: 700; margin-top: 4px; }
.stat .value.small { font-size: 13px; font-weight: 500; }

label { display: block; margin: 12px 0 6px; font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=number], select { width: 100%; background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px; padding: 9px 11px; font: inherit; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=color] { width: 60px; height: 40px; border: 0; background: none; padding: 0; }
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.row.space { justify-content: space-between; margin-top: 0; }
.row select { flex: 1; min-width: 200px; }

.btn { background: var(--accent); color: #fff; border: 1px solid transparent; border-radius: 7px; padding: 8px 14px; font: inherit;
  font-weight: 500; cursor: pointer; text-decoration: none; display: inline-block; margin-top: 14px; }
.row .btn { margin-top: 0; }
.btn:hover { background: var(--accent-h); }
.btn.secondary { background: var(--panel2); border-color: var(--border); color: var(--text); }
.btn.secondary:hover { background: #2a2a30; }
.btn.danger { background: transparent; border-color: rgba(239, 68, 68, .6); color: #f87171; }
.btn.danger:hover { background: rgba(239, 68, 68, .12); }
.btn.tiny { padding: 5px 10px; font-size: 12.5px; margin: 0; }
.btn.tiny:not(.secondary):not(.danger) { background: var(--panel2); border-color: var(--border); color: var(--text); }
.btn.tiny:not(.secondary):not(.danger):hover { background: #2a2a30; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text); margin: 8px 0; }
.switch input { display: none; }
.switch span { width: 40px; height: 22px; background: var(--border); border-radius: 11px; position: relative; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { left: 21px; }

.pair { display: grid; grid-template-columns: 140px 1fr auto; gap: 8px; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px; cursor: pointer; user-select: none; font-size: 14px; }
.chip.on { background: var(--accent); border-color: var(--accent); }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
.table th { color: var(--faint); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; }

.rr-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.rr-item:last-child { border-bottom: 0; }
.role-tag { display: inline-block; padding: 1px 8px; border-radius: 4px; background: var(--panel2); margin: 2px 4px 2px 0; font-size: 13px; }

.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.game { background: var(--panel2); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); text-decoration: none; color: var(--text); }
.game img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: var(--panel2); }
.game .info { padding: 10px 12px; }
.game .title { font-weight: 600; font-size: 14px; }
.game .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }

.logs { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 12px; height: 520px; overflow: auto; font: 12.5px/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; margin: 10px 0 0; }
.log-warn { color: var(--yellow); }
.log-error { color: var(--red); }

.banner { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.banner.error { background: rgba(239, 68, 68, .1); border: 1px solid rgba(239, 68, 68, .5); }
.hidden { display: none !important; }

.toast { position: fixed; bottom: 24px; right: 24px; background: var(--panel2); border: 1px solid var(--border);
  border-left: 4px solid var(--green); padding: 12px 18px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: 380px; }
.toast.err { border-left-color: var(--red); }

/* ---------- Editor + Discord-Vorschau ---------- */
textarea { width: 100%; background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 0 0 6px 6px;
  padding: 10px; font: 14px/1.5 inherit; font-family: inherit; resize: vertical; }
textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.preview-card { position: sticky; top: 12px; }
@media (max-width: 900px) { .editor-layout { grid-template-columns: 1fr; } .preview-card { position: static; } }

.md-toolbar { display: flex; flex-wrap: wrap; gap: 2px; background: var(--panel2); border: 1px solid var(--border);
  border-bottom: 0; border-radius: 6px 6px 0 0; padding: 4px; }
.md-toolbar button { background: none; border: 0; color: var(--text); min-width: 32px; height: 30px; border-radius: 4px; cursor: pointer; font: inherit; font-size: 14px; }
.md-toolbar button:hover { background: var(--border); }

.pair { grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr) auto; }
@media (max-width: 600px) { .pair { grid-template-columns: 80px 1fr auto; } .pair .pl { grid-column: 1 / -1; } }

details.extras { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 10px; }
details.extras summary { cursor: pointer; color: var(--muted); font-size: 14px; }
input:disabled { opacity: .45; }

.dc-msg { background: #313338; border-radius: 8px; padding: 14px; }
.dc-author { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.dc-author img { width: 36px; height: 36px; border-radius: 50%; background: var(--panel2); }
.dc-author b { color: #f2f3f5; }
.dc-badge { background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 4px; border-radius: 3px; }
.dc-content { margin: 0 0 4px 44px; color: #dbdee1; }
.dc-embed { margin-left: 44px; background: #2b2d31; border-left: 4px solid #5865f2; border-radius: 4px; padding: 10px 14px 14px 12px;
  max-width: 520px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; color: #dbdee1; font-size: 14.5px; line-height: 1.4; }
.dc-embed .dc-title { font-weight: 700; color: #f2f3f5; font-size: 16px; }
.dc-embed .dc-thumb { grid-column: 2; grid-row: 1 / span 2; width: 80px; height: 80px; border-radius: 4px; object-fit: cover; }
.dc-embed .dc-desc { grid-column: 1; overflow-wrap: anywhere; }
.dc-embed .dc-image { grid-column: 1 / -1; max-width: 100%; border-radius: 4px; }
.dc-embed .dc-footer { grid-column: 1 / -1; font-size: 12px; color: #b5bac1; display: flex; align-items: center; gap: 6px; }
.dc-embed .dc-footer img { width: 20px; height: 20px; border-radius: 50%; }
.dc-desc h1 { font-size: 22px; margin: 6px 0 2px; color: #f2f3f5; }
.dc-desc h2 { font-size: 19px; margin: 6px 0 2px; color: #f2f3f5; }
.dc-desc h3 { font-size: 16px; margin: 6px 0 2px; color: #f2f3f5; }
.dc-desc .sub { font-size: 12px; color: #949ba4; }
.dc-desc blockquote { margin: 2px 0; padding-left: 10px; border-left: 4px solid #4e5058; }
.dc-desc .li { padding-left: 4px; }
.dc-desc .gap { height: .6em; }
.dc-desc code { background: #1e1f22; padding: 0 4px; border-radius: 3px; font-size: 13px; }
.dc-desc a { color: #00a8fc; text-decoration: none; }
.dc-desc .mention { background: rgba(88, 101, 242, .3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.dc-desc .spoiler { background: #1e1f22; color: transparent; border-radius: 3px; }
.dc-desc .spoiler:hover { color: inherit; }
.dc-desc img.emoji { width: 20px; height: 20px; vertical-align: -4px; }
.dc-reactions { margin: 6px 0 0 44px; display: flex; gap: 4px; flex-wrap: wrap; }
.dc-reactions span { background: #2b2d31; border: 1px solid #3f4147; border-radius: 8px; padding: 2px 8px; font-size: 14px; }
.dc-reactions img { width: 16px; height: 16px; vertical-align: -3px; }

/* ---------- Twitch ---------- */
.tw-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tw-item:last-child { border-bottom: 0; }
.tw-item img { width: 44px; height: 44px; border-radius: 50%; background: var(--panel2); }
.tw-item .tw-info { flex: 1; min-width: 200px; }
.tw-item .tw-name { font-weight: 600; }
.tw-item .tw-meta { color: var(--muted); font-size: 13px; }
.tw-live { background: #e91916; color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
.tw-off { background: var(--panel2); color: var(--muted); font-size: 11px; padding: 1px 6px; border-radius: 4px; margin-left: 6px; }

/* ---------- Login / leerer Zustand / Benutzer ---------- */
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
#loginScreen.center-screen { min-height: 100vh; }
.center-card { max-width: 420px; width: 100%; text-align: center; padding: 32px 28px; }
.center-card.wide { max-width: 560px; }
.center-card h2 { margin: 8px 0 6px; }
.login-logo { font-size: 44px; line-height: 1; }
.discord-btn { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; padding: 12px 22px; margin: 18px 0 14px; }
.center-row { justify-content: center; }
.addable-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 4px; text-align: left; }
.addable { display: flex; align-items: center; gap: 12px; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.addable img, .addable .noicon { width: 36px; height: 36px; border-radius: 50%; background: var(--panel2); flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); }
.addable .name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addable .btn { margin: 0; }

.logout-btn { width: 30px; height: 30px; padding: 0 !important; display: inline-flex !important; align-items: center; justify-content: center;
  font-size: 15px !important; flex: none; }
