:root {
  --bg: #0d1012;
  --bg-2: #12161a;
  --panel: #161b20;
  --panel-2: #1c2228;
  --line: #262e36;
  --line-2: #323b45;
  --text: #e8ecef;
  --muted: #8b96a1;
  --faint: #5d6873;
  --accent: #4fbf7a;
  --accent-2: #3ea867;
  --accent-ink: #062112;
  --accent-soft: rgba(79, 191, 122, .14);
  --warn: #e3b341;
  --warn-soft: rgba(227, 179, 65, .14);
  --bad: #ef5d55;
  --bad-soft: rgba(239, 93, 85, .14);
  --blue: #5aa9ff;
  --violet: #b38cf5;
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f5f7; --bg-2: #eceff2; --panel: #ffffff; --panel-2: #f5f7f9; --line: #e1e6eb; --line-2: #d2d9e0;
    --text: #172026; --muted: #5d6974; --faint: #8b96a1; --accent: #1f9a52; --accent-2: #178246; --accent-ink: #fff;
    --accent-soft: rgba(31, 154, 82, .1); --warn: #a87400; --warn-soft: rgba(168, 116, 0, .1); --bad: #cf3a33; --bad-soft: rgba(207, 58, 51, .1);
    --blue: #1f6feb; --violet: #7c4dce; --shadow: 0 10px 30px rgba(20, 30, 40, .12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.boot { padding: 40px; color: var(--muted); text-align: center; }
[hidden] { display: none !important; }

/* ---- Bedienelemente ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--radius-s); border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; white-space: nowrap; font-weight: 500; transition: background .12s, border-color .12s; }
.btn:hover:not(:disabled) { border-color: var(--faint); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--panel-2); color: var(--text); border-color: transparent; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: transparent; }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn.block { width: 100%; height: 40px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=file], select, textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 8px 11px; min-height: 36px;
}
textarea { resize: vertical; min-height: 90px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: -1px; border-color: transparent; }
input[type=range] { width: 100%; accent-color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > .label { font-weight: 600; font-size: 13px; }
.field > .help { color: var(--muted); font-size: 12.5px; margin-top: -2px; }
.field-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.field-row:last-child { border-bottom: 0; }
.field-row .label { font-weight: 600; font-size: 13.5px; }
.field-row .help { color: var(--muted); font-size: 12.5px; }
.range-val { min-width: 74px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Schalter */
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; cursor: default; }

.badge { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; font-size: 11.5px; color: var(--muted); height: 20px; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.running { background: var(--accent-soft); color: var(--accent); }
.pill.preparing, .pill.starting, .pill.stopping { background: var(--warn-soft); color: var(--warn); }
.pill.error { background: var(--bad-soft); color: var(--bad); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.running { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot.preparing, .dot.starting, .dot.stopping { background: var(--warn); }
.dot.error { background: var(--bad); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15px; }
.card-body { padding: 4px 18px 14px; }
.note { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px; color: var(--muted); font-size: 13px; }
.note.warn { background: var(--warn-soft); border-color: transparent; color: var(--text); }
.note.bad { background: var(--bad-soft); border-color: transparent; color: var(--text); }
.empty-state { text-align: center; padding: 56px 24px; }
.empty-state h2 { font-size: 20px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); max-width: 440px; margin: 0 auto 20px; }

/* ---- Anmeldung ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent); }
.auth-card { width: min(400px, 100%); padding: 28px; box-shadow: var(--shadow); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; text-align: center; }
.auth-brand .logo { width: 44px; height: 44px; }
.auth-brand h1 { font-size: 20px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-2); border-radius: var(--radius-s); padding: 3px; margin-bottom: 18px; }
.seg button { border: 0; background: none; padding: 7px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---- App-Rahmen ---- */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side { background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 700; font-size: 15px; }
.side-brand .logo { width: 26px; height: 26px; }
.nav { padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: var(--radius-s); cursor: pointer; color: var(--muted); font-weight: 500; text-align: left; }
.nav button:hover { background: var(--panel); color: var(--text); }
.nav button.active { background: var(--panel); color: var(--text); }
.nav svg { width: 17px; height: 17px; flex: none; }
.side-section { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 6px; color: var(--faint); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.bot-list { flex: 1; overflow: auto; padding: 0 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.bot-item { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-s); cursor: pointer; border: 1px solid transparent; background: none; width: 100%; text-align: left; }
.bot-item:hover { background: var(--panel); }
.bot-item.active { background: var(--panel); border-color: var(--line-2); }
.bot-item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-item .sub { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; background: var(--accent-soft); color: var(--accent); flex: none; }
.avatar.lg { width: 44px; height: 44px; border-radius: 12px; font-size: 18px; }
.side-foot { border-top: 1px solid var(--line); padding: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: var(--radius-s); border: 0; background: none; cursor: pointer; text-align: left; }
.user-chip:hover { background: var(--panel); }
.user-chip .avatar { background: var(--panel-2); color: var(--text); }
.totals { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 20px 12px; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.main { min-width: 0; padding: 26px 32px 48px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; letter-spacing: -.01em; }
.page-head .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs svg { width: 16px; height: 16px; }
.detail-line { color: var(--muted); font-size: 13px; margin: -8px 0 16px; min-height: 18px; }
.detail-line.error { color: var(--bad); }

/* ---- Statistik ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 14px 16px; min-height: 96px; display: flex; flex-direction: column; gap: 4px; }
.stat .k { color: var(--muted); font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .k svg { width: 14px; height: 14px; }
.stat .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat .s { color: var(--muted); font-size: 12px; }
.stat canvas { width: 100%; height: 30px; display: block; margin-top: auto; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.scoreboard { overflow: hidden; }
.scoreboard .title { text-align: center; font-weight: 700; padding: 10px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.scoreboard ol { list-style: none; margin: 0; padding: 8px 0; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.scoreboard li { padding: 3px 16px; white-space: pre-wrap; word-break: break-word; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---- Macros ---- */
.macro-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.module-head { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; }
.module-head h3 { font-size: 15px; }
.module-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.module-body { border-top: 1px solid var(--line); padding: 4px 18px 10px; }
.setting { display: grid; grid-template-columns: 1fr 160px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .label { font-size: 13px; font-weight: 600; }
.setting .help { color: var(--muted); font-size: 12px; }
.setting .control { display: flex; justify-content: flex-end; }
.files { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; max-height: 220px; overflow: auto; }
.file { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); cursor: pointer; background: var(--bg-2); }
.file.active { border-color: var(--accent); background: var(--accent-soft); }
.file .size { margin-left: auto; color: var(--faint); font-size: 12px; }

/* ---- Konsole ---- */
.console { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px; height: 420px; overflow: auto; font: 12.5px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; margin: 0; }
.seg-inline { display: inline-grid; grid-auto-flow: column; background: var(--bg-2); border-radius: var(--radius-s); padding: 3px; }
.seg-inline button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg-inline button.active { background: var(--panel); color: var(--text); }

/* ---- Tabellen ---- */
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* ---- Dialoge ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: grid; place-items: center; padding: 16px; z-index: 40; animation: fade .12s ease-out; }
.modal { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow); }
.modal .card-head { position: sticky; top: 0; background: var(--panel); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); }
.option-grid { display: grid; gap: 10px; }
.option { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg-2); cursor: pointer; width: 100%; }
.option:hover { border-color: var(--accent); }
.option b { display: block; margin-bottom: 2px; }
.option span { color: var(--muted); font-size: 13px; }
.code-box { text-align: center; padding: 16px; background: var(--bg-2); border-radius: var(--radius); }
.code-box .code { font-size: 30px; font-weight: 800; letter-spacing: .14em; user-select: all; margin: 6px 0; font-family: ui-monospace, Consolas, monospace; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line-2); padding: 10px 18px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.bad { border-color: var(--bad); color: var(--bad); }

.mobile-bar { display: none; }

@media (max-width: 1020px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .shell.menu-open .side { transform: none; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); position: sticky; top: 0; z-index: 20; }
  .main { padding: 18px 16px 40px; }
  .macro-grid { grid-template-columns: 1fr; }
  .setting { grid-template-columns: 1fr; }
  .setting .control { justify-content: flex-start; }
  .console { height: 320px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
