:root {
  --bg: #e9ebef;
  --panel: #ffffff;
  --side: #f5f6f8;
  --line: #d8dce2;
  --line-soft: #e8ebef;
  --text: #1e2430;
  --muted: #6a7280;
  --orange: #f2711c;
  --orange-d: #d95f10;
  --orange-l: #fff1e6;
  --green: #1f9d55;
  --green-l: #e5f6ec;
  --red: #d63b3b;
  --red-l: #fdeaea;
  --yellow: #c58a06;
  --yellow-l: #fdf4dc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 2px 8px rgba(20, 30, 50, .04);
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--text);
}
a { color: var(--orange-d); }
h1, h2, h3 { margin: 0; font-weight: 650; }
h3 { font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.mono { font-family: var(--mono); }

/* ── Layout ───────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex-shrink: 0; background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 14px; }
.logo {
  width: 38px; height: 38px; border-radius: 9px; background: var(--orange); color: #fff;
  display: grid; place-items: center; font-weight: 800; letter-spacing: .5px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.15);
}
.brand-name { font-weight: 750; font-size: 16px; }
.brand-sub { font-size: 12px; color: var(--muted); }
#nav { padding: 6px 10px; flex: 1; overflow-y: auto; }
#nav .nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 10px 4px; }
#nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; margin: 1px 0; font-weight: 500;
}
#nav a .ico { width: 18px; text-align: center; color: var(--muted); }
#nav a:hover { background: #eceef2; }
#nav a.active { background: var(--orange-l); color: var(--orange-d); }
#nav a.active .ico { color: var(--orange); }
.sidebar-foot { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #d5d9df; object-fit: cover; flex-shrink: 0; }
.me-name { font-weight: 600; line-height: 1.2; }
.me-role { font-size: 12px; color: var(--muted); }
.sidebar-foot .icon-btn { margin-left: auto; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: rgba(233,235,239,.92); backdrop-filter: blur(6px);
  display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.topbar h1 { font-size: 19px; margin-right: auto; }
.menu-btn { display: none; }
.view { padding: 22px 24px 40px; max-width: 1400px; width: 100%; }

/* ── Status & Buttons ─────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px;
  background: var(--panel); border: 1px solid var(--line); font-weight: 600; font-size: 13px;
}
.status-badge .dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa1ab; }
.status-badge.on .dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-l); }
.status-badge.wait .dot { background: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-l); animation: pulse 1.2s infinite; }
.status-badge.off .dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-l); }
@keyframes pulse { 50% { opacity: .4; } }
.power { display: flex; gap: 6px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 7px 13px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: #f3f4f6; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-orange:hover { background: var(--orange-d); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: #188547; }
.btn-red { background: var(--panel); border-color: #f0b8b8; color: var(--red); }
.btn-red:hover { background: var(--red-l); }
.btn-dark { background: #3a4150; border-color: #3a4150; color: #fff; }
.btn-dark:hover { background: #2c323d; }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn-ghost { border-color: transparent; background: transparent; }
.icon-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 16px; color: var(--muted); }
.icon-btn:hover { color: var(--text); background: #f3f4f6; }
.chip { border: 1px solid var(--line); background: var(--side); border-radius: 99px; padding: 3px 11px; font: 12px var(--mono); cursor: pointer; color: var(--text); }
.chip:hover { border-color: var(--orange); color: var(--orange-d); background: var(--orange-l); }

/* ── Karten & Raster ──────────────────── */
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.stats { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1500px) { .grid.stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .grid.stats { grid-template-columns: repeat(2, 1fr); } .stat-value { font-size: 20px; } }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card.error { color: var(--red); background: var(--red-l); border-color: #f0b8b8; }
.loading { color: var(--muted); padding: 30px; text-align: center; }

.stat { position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--orange); opacity: .85; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--muted); min-height: 18px; }
.bar { height: 5px; background: var(--line-soft); border-radius: 9px; margin-top: 8px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--orange); border-radius: 9px; transition: width .4s; }
.bar span.warn { background: var(--yellow); }
.bar span.ok { background: var(--green); }
.bar span.crit { background: var(--red); }

.chart { position: relative; }
.chart svg { width: 100%; height: 150px; display: block; }
.chart .grid-line { stroke: var(--line-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend b { color: var(--text); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; }
.kv dt, .kv .k { color: var(--muted); }
.kv .v { font-weight: 550; word-break: break-word; }

.player-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { display: inline-flex; align-items: center; gap: 7px; background: var(--side); border: 1px solid var(--line); padding: 4px 10px 4px 4px; border-radius: 99px; font-weight: 550; }
.pchip img, .head { width: 24px; height: 24px; border-radius: 5px; image-rendering: pixelated; background: #ccd1d8; }
.empty { color: var(--muted); padding: 14px 0; text-align: center; }

/* ── Tabellen ─────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--side); }
tr:hover td { background: #fafbfc; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 4px; }
.file-link { color: var(--text); text-decoration: none; font-weight: 550; cursor: pointer; }
.file-link:hover { color: var(--orange-d); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 650; background: var(--side); border: 1px solid var(--line); color: var(--muted); }
.tag.green { background: var(--green-l); color: var(--green); border-color: #bfe6cf; }
.tag.red { background: var(--red-l); color: var(--red); border-color: #f0c4c4; }
.tag.orange { background: var(--orange-l); color: var(--orange-d); border-color: #f9cfae; }

/* ── Formulare ────────────────────────── */
input, select, textarea {
  font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-l); }
input[type=checkbox] { width: auto; accent-color: var(--orange); }
.input-sm { padding: 4px 9px; font-size: 13px; width: 170px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input, .row > select { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 18px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 3px; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 500; }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.alert { padding: 10px 12px; border-radius: 8px; background: var(--red-l); color: var(--red); border: 1px solid #f0c4c4; margin: 12px 0; }
.alert.info { background: var(--orange-l); color: #8a4310; border-color: #f9cfae; }

/* ── Konsole ──────────────────────────── */
.console {
  background: #23272f; color: #d8dde5; font: 12.5px/1.55 var(--mono); border-radius: 8px;
  height: calc(100vh - 330px); min-height: 320px; overflow: auto; padding: 12px 14px; margin: 0;
  white-space: pre-wrap; word-break: break-all;
}
.console .l-warn { color: #f5c26b; }
.console .l-err { color: #ff8080; }
.console .l-cmd { color: #ffab70; }
.console .l-sys { color: #8b95a5; }
.cmd-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.cmd-row .prompt { font: 700 16px var(--mono); color: var(--orange); }
.cmd-row input { font-family: var(--mono); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ── Dateien ──────────────────────────── */
.crumbs { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; font-weight: 550; }
.crumbs a { cursor: pointer; padding: 2px 6px; border-radius: 6px; color: var(--text); text-decoration: none; }
.crumbs a:hover { background: var(--orange-l); color: var(--orange-d); }
.crumbs span { color: var(--muted); }
.dropzone { border: 2px dashed var(--line); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); margin-bottom: 12px; transition: .15s; }
.dropzone.over { border-color: var(--orange); background: var(--orange-l); color: var(--orange-d); }
.editor { width: 100%; height: 62vh; font: 13px/1.5 var(--mono); resize: vertical; white-space: pre; tab-size: 2; }

/* ── Modal & Toasts ───────────────────── */
.modal { position: fixed; inset: 0; background: rgba(25, 30, 40, .45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-box { background: var(--panel); border-radius: 12px; padding: 20px 22px; width: min(480px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal-box.wide { width: min(1100px, 100%); }
.modal-box h3 { font-size: 17px; margin-bottom: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #2c323d; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.18); max-width: 380px; border-left: 4px solid var(--orange); animation: slide .2s ease-out; }
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }

/* ── Login ────────────────────────────── */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px;
  background: radial-gradient(circle at 20% 10%, #fde3cf 0, transparent 40%), var(--bg); }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 30px; width: min(400px, 100%); box-shadow: 0 8px 30px rgba(20,30,50,.08); }
.brand-lg { padding: 0 0 14px; }
.brand-lg .logo { width: 48px; height: 48px; font-size: 18px; }
.brand-lg .brand-name { font-size: 22px; }
.btn-discord { width: 100%; padding: 12px; font-size: 15px; background: #5865f2; border-color: #5865f2; color: #fff; margin: 14px 0 10px; }
.btn-discord:hover { background: #4752c4; }

/* ── Mobil ────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .backdrop { display: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 30; }
  .menu-btn { display: inline-block; }
  .topbar { padding: 12px 16px; }
  .view { padding: 16px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .power .btn { padding: 6px 10px; font-size: 12px; }
}
