:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1e232b;
  --line: #2a313b;
  --text: #e6e9ee;
  --muted: #8b95a3;
  --accent: #5cb85c;
  --accent-2: #4a9d4a;
  --blue: #4c8dff;
  --yellow: #e5b53e;
  --red: #e5534b;
  --orange: #e8833a;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; }
h2 { font-size: 15px; margin-bottom: 12px; }
h3 { font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ok-text { color: var(--accent); }
.warn-text { color: var(--yellow); }
code, .mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* ---------- Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px;
  background: rgba(15, 18, 22, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo { width: 26px; height: 26px; border-radius: 6px; }
.sysinfo { display: flex; gap: 18px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.sysinfo b { color: var(--text); font-weight: 600; }
.meter { display: inline-block; width: 70px; height: 6px; background: var(--panel-2); border-radius: 3px; vertical-align: middle; margin-left: 6px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); }
.meter.warn > i { background: var(--yellow); }
.meter.crit > i { background: var(--red); }

main { max-width: 1280px; margin: 0 auto; padding: 24px 20px 60px; }

/* ---------- Bedienelemente */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer;
  white-space: nowrap;
}
button:hover:not(:disabled) { border-color: #3a4350; background: #252b35; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #0b1a0b; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
button.danger { color: var(--red); }
button.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
button.ghost, .btn.ghost { background: transparent; border-color: transparent; }
button.ghost:hover:not(:disabled), .btn.ghost:hover { background: var(--panel-2); text-decoration: none; }
button.sm, .btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
button.icon { width: 30px; height: 30px; padding: 0; }

input, select, textarea {
  width: 100%;
  height: 36px; padding: 0 10px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  font: inherit;
}
textarea { height: auto; padding: 10px; font-family: var(--mono); font-size: 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
label { display: block; }
label > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check > span { margin: 0; color: var(--text); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid > .card { margin: 0; }
.card.danger-zone { border-color: rgba(229, 83, 75, .4); }

/* ---------- Status */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--panel-2); color: var(--muted);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.online { color: var(--accent); background: rgba(92, 184, 92, .12); }
.pill.starting, .pill.stopping { color: var(--yellow); background: rgba(229, 181, 62, .12); }
.pill.starting::before, .pill.stopping::before { animation: pulse 1s infinite; }
.pill.crashed { color: var(--red); background: rgba(229, 83, 75, .12); }
.pill.external { color: var(--blue); background: rgba(76, 141, 255, .12); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Dashboard */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.srv { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: border-color .15s; }
.srv:hover { border-color: #3a4350; }
.srv-head { display: flex; align-items: flex-start; gap: 10px; }
.srv-title { flex: 1; min-width: 0; }
.srv-title h3 { margin: 0 0 2px; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.srv-meta b { color: var(--text); font-weight: 500; }
.srv-players { font-size: 12px; color: var(--muted); min-height: 18px; }
.srv-actions { display: flex; gap: 8px; margin-top: auto; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ---------- Serverseite */
.back { color: var(--muted); font-size: 13px; display: inline-block; margin-bottom: 12px; }
.server-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.server-head h1 { font-size: 22px; }
.addr { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 4px 4px 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.stat .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 16px; font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; }
.tabs a { padding: 10px 16px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Konsole */
.console {
  height: calc(100vh - 360px); min-height: 320px;
  overflow-y: auto;
  background: #0a0c0f; border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
  padding: 10px 12px;
  font: 12.5px/1.5 var(--mono);
  white-space: pre-wrap; word-break: break-word;
}
.console .l-warn { color: var(--yellow); }
.console .l-error { color: var(--red); }
.console .l-cmd { color: var(--blue); }
.console .l-join { color: var(--accent); }
.console-input { display: flex; border: 1px solid var(--line); border-top: none; border-radius: 0 0 var(--radius) var(--radius); background: var(--panel); }
.console-input .prompt { padding: 0 4px 0 12px; display: flex; align-items: center; color: var(--accent); font-family: var(--mono); }
.console-input input { border: none; background: transparent; font-family: var(--mono); height: 42px; }
.console-input button { border: none; border-left: 1px solid var(--line); border-radius: 0 0 var(--radius) 0; height: 42px; }
.console-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--muted); font-size: 12px; }

/* ---------- Dateien */
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; flex: 1; min-width: 200px; }
.crumbs a { padding: 2px 6px; border-radius: 6px; color: var(--text); }
.crumbs a:hover { background: var(--panel-2); text-decoration: none; }
.files { width: 100%; border-collapse: collapse; margin-top: 12px; }
.files th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.files td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
.files tr:hover td { background: var(--panel-2); }
.table-wrap { overflow-x: auto; }
.files td.name { cursor: pointer; }
.files .fname { display: flex; align-items: center; gap: 10px; word-break: break-all; }
.files .fname svg { flex: none; }
.files td.num { color: var(--muted); font-size: 12px; white-space: nowrap; }
.files td.act { text-align: right; white-space: nowrap; }
.files td.act button { opacity: .55; }
.files tr:hover td.act button { opacity: 1; }
.dropzone { outline: 2px dashed var(--blue); outline-offset: -2px; border-radius: var(--radius); }

/* ---------- Eigenschaften */
.props { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px 20px; }
.prop { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.prop .key { flex: 1; font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.prop input[type=text] { width: 160px; height: 30px; font-size: 13px; }
.prop.changed .key { color: var(--yellow); }

/* ---------- Dialoge */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.modal.wide { max-width: 1100px; }
.modal h2 { margin-bottom: 16px; font-size: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.editor { width: 100%; height: 62vh; tab-size: 4; white-space: pre; }

/* ---------- Anmeldung */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth { width: 100%; max-width: 380px; }
.auth .brand { justify-content: center; margin-bottom: 20px; font-size: 20px; }
.auth form > * + * { margin-top: 12px; }
.auth button[type=submit] { width: 100%; height: 40px; }
.qr { display: block; margin: 8px auto; border-radius: 8px; background: #fff; padding: 6px; }
.secret { font-family: var(--mono); font-size: 12px; text-align: center; word-break: break-all; color: var(--muted); }

/* ---------- Meldungen */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); animation: slide .2s ease-out; }
.toast.error { border-left-color: var(--red); }
.toast .bar { height: 4px; background: var(--bg); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.toast .bar > i { display: block; height: 100%; background: var(--blue); width: 0; transition: width .2s; }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }

.notice { padding: 10px 14px; border-radius: 8px; background: rgba(229, 181, 62, .1); border: 1px solid rgba(229, 181, 62, .3); color: #f0d48a; font-size: 13px; }
.notice.info { background: rgba(76, 141, 255, .08); border-color: rgba(76, 141, 255, .3); color: #a9c6ff; }
.error-text { color: var(--red); font-size: 13px; min-height: 18px; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .topbar { position: static; padding: 10px 16px; gap: 6px 12px; }
  .topbar > .row { margin-left: auto; }
  .sysinfo { order: 3; flex-basis: 100%; gap: 4px 14px; }
  .sysinfo > span:nth-child(n+3) { display: none; }
  .files .date { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .server-head h1 { font-size: 19px; }

  main { padding: 16px 16px 60px; }
  .grid { grid-template-columns: 1fr; }
  .console { height: 60vh; }
  .prop input[type=text] { width: 120px; }
}

/* ---------- Allgemeine Listen */
.card-head { margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.stack > .card + .card, .two-col .card + .card { margin-top: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.two-col > .stack > .card { margin: 0; }
.two-col > .stack > .card + .card { margin-top: 16px; }
.plist { list-style: none; margin: 0; padding: 0; }
.plist > li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.plist > li:last-child { border-bottom: none; }
.avatar { flex: none; width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); font-weight: 700; font-size: 13px; }
.pname { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 2px; flex-wrap: nowrap; }
.badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: 11px; font-weight: 600; vertical-align: middle; }
.disabled .pinfo, .task.disabled > .grow { opacity: .55; }
details > summary { cursor: pointer; color: var(--muted); font-weight: 500; }
details[open] > summary { margin-bottom: 10px; }

/* ---------- Umschalter */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { height: 28px; border: none; background: transparent; color: var(--muted); padding: 0 12px; font-size: 13px; }
.seg button.active { background: var(--panel-2); color: var(--text); }

/* ---------- Plugins */
.pinfo { min-width: 0; overflow-wrap: anywhere; }
.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; margin-top: 14px; }
.plugin-card { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.picon { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--panel-2); display: grid; place-items: center; }
.pbody { min-width: 0; }
.ptitle { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptitle a { color: var(--text); }
.pdesc { margin: 4px 0 0; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Zeitplan */
.days { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.day { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.day > span { margin: 0; color: var(--text); font-size: 13px; }

/* ---------- Statistik */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.charts > .card { margin: 0; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.chart-now { font-size: 20px; font-weight: 600; }
.chart-box { position: relative; min-height: 170px; }
.chart-box svg { display: block; overflow: visible; }
.chart-box .grid { stroke: var(--line); stroke-width: 1; }
.chart-box .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-box .line { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .area { fill: var(--blue); opacity: .12; }
.chart-box .ref { stroke: var(--muted); stroke-dasharray: 4 4; stroke-width: 1; }
.chart-box .cross { stroke: var(--muted); stroke-width: 1; }
.chart-box .dot { fill: var(--blue); stroke: var(--panel); stroke-width: 2; }
.chart-tip { position: absolute; pointer-events: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); font-variant-numeric: tabular-nums; }

/* ---------- Benutzer */
.user-row .grow { min-width: 0; overflow-wrap: anywhere; }
.perm-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.perm-table th, .perm-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.perm-table th:first-child { text-align: left; }
.perm-table thead th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
.invite-link { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; word-break: break-all; font-size: 13px; }
nav.row .btn { height: 28px; }

@media (max-width: 640px) {
  .two-col { grid-template-columns: 1fr; }
  .charts { grid-template-columns: 1fr; }
  .plugin-grid { grid-template-columns: 1fr; }
  .plugin-card { grid-template-columns: 40px 1fr; }
  .plugin-card .pact { grid-column: 1 / -1; justify-self: start; }
  .plist > li { flex-wrap: wrap; }
  .plist .row-actions { flex-basis: 100%; flex-wrap: wrap; padding-left: 38px; }
  .plist .pname { overflow-wrap: normal; word-break: break-word; }
  .tabs a { padding: 10px 12px; }
}
.row > div.grow { min-width: 160px; }
