:root {
  --bg: #0b0e12; --card: #141a22; --card2: #19212b; --line: #222c38; --text: #e8edf3; --dim: #9aa7b6; --mute: #677585;
  --accent: #ff7a1a; --accent-text: #120a03; --ok: #3ccf8e; --err: #ff6464; --warn: #f5b942;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 24px; margin: 0 0 4px; text-wrap: balance; }
h2 { font-size: 16px; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.loading { padding: 48px; text-align: center; color: var(--dim); }
.dim { color: var(--dim); }
.small { font-size: 13px; }

/* Anmeldung */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 36px; max-width: 420px; width: 100%; text-align: center; }
.login-box img { width: 56px; height: 56px; }
.login-box h1 { margin: 14px 0 8px; }
.login-box .btn { margin-top: 18px; width: 100%; justify-content: center; }
.alert { background: rgba(255, 100, 100, .12); border: 1px solid var(--err); color: #ffd0d0; border-radius: 8px; padding: 10px 12px; margin-top: 16px; text-align: left; }

/* Gerüst */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100%; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 14px; font-weight: 700; font-size: 17px; }
.brand img { width: 30px; height: 30px; }
.guild { display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; }
.guild img, .guild .ph { width: 34px; height: 34px; border-radius: 9px; background: var(--line); flex: none; }
.guild select { width: 100%; }
.guild b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-title { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); padding: 12px 10px 6px; }
.nav button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--dim); font: inherit; text-align: left; cursor: pointer; }
.nav button:hover { background: var(--card2); color: var(--text); }
.nav button.on { background: rgba(255, 122, 26, .14); color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mute); flex: none; margin-left: auto; }
.dot.live { background: var(--ok); }
.main { padding: 26px 32px 110px; max-width: 980px; width: 100%; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.user { display: flex; align-items: center; gap: 10px; color: var(--dim); white-space: nowrap; }
.user img { width: 30px; height: 30px; border-radius: 50%; }

/* Bausteine */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 18px; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card2); color: var(--text); border-radius: 8px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--mute); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: none; }
.btn.danger { color: var(--err); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
input[type=text], input[type=number], select, textarea { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: inherit; }
textarea { min-height: 84px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .nav button:focus-visible, .switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=color] { width: 44px; height: 40px; padding: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; flex: none; }
.field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 8px 24px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.field:first-of-type { border-top: 0; padding-top: 0; }
.field label { font-weight: 600; }
.field .key { display: block; font-weight: 400; font-size: 12px; color: var(--mute); font-family: ui-monospace, Consolas, monospace; }
.field .ctl { display: flex; gap: 8px; align-items: center; }
.field.bad input, .field.bad select, .field.bad textarea { border-color: var(--err); }
.field .msg { grid-column: 2; color: var(--err); font-size: 13px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 13px; transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.power { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.power b { font-size: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > select, .row > input { flex: 1 1 180px; width: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat b { display: block; font-size: 28px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--dim); font-size: 13px; }
.modcard { margin-top: 18px; }
.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.mod { display: flex; align-items: center; gap: 10px; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.mod:hover { border-color: var(--mute); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--mute); font-weight: 600; padding: 0 8px 8px 0; }
td { padding: 8px 8px 8px 0; border-top: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
td:last-child { text-align: right; white-space: nowrap; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 14px; align-items: end; }
.form label { font-size: 12px; color: var(--dim); display: block; margin-bottom: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; }
.pill i { width: 10px; height: 10px; border-radius: 50%; background: var(--mute); display: inline-block; }
.savebar { position: fixed; left: 250px; right: 0; bottom: 0; background: rgba(20, 26, 34, .96); border-top: 1px solid var(--line); padding: 12px 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.savebar[hidden] { display: none; }
#toast { position: fixed; right: 20px; top: 20px; background: var(--card2); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 8px; padding: 12px 16px; max-width: 360px; z-index: 5; }
#toast.err { border-left-color: var(--err); }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav button { width: auto; }
  .nav-title { width: 100%; }
  .dot { margin-left: 4px; }
  .main { padding: 20px 16px 120px; }
  .field { grid-template-columns: 1fr; }
  .field .msg { grid-column: 1; }
  .savebar { left: 0; padding: 12px 16px; }
  .top { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
