:root {
  --bg: #0f1419;
  --panel: #171e26;
  --panel-2: #1e2731;
  --line: #2a3542;
  --text: #e6edf3;
  --muted: #8b98a7;
  --accent: #3fa36b;
  --accent-2: #2f7d4f;
  --warn: #d9a43b;
  --danger: #d9534f;
  --info: #4b8fd9;
  --radius: 10px;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f5f7; --panel: #ffffff; --panel-2: #f7f9fb; --line: #dde3ea;
    --text: #18212b; --muted: #5f6b78; color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 "Segoe UI", system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .75rem; }
h3 { font-size: 1rem; margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* Kopfleiste */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1.25rem;
  padding: .6rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 650; color: var(--text); }
.brand img { width: 26px; height: 26px; }
.topbar nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); padding: .35rem .7rem; border-radius: 7px; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.user { display: flex; align-items: center; gap: .5rem; color: var(--muted); }

main { max-width: 1240px; margin: 0 auto; padding: 1.25rem 16px 3rem; }

/* Bausteine */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .9rem; border-radius: 7px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.small { padding: .2rem .55rem; font-size: .85rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 7px; padding: .45rem .6rem; width: 100%; }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
textarea { font-family: var(--mono); font-size: .85rem; min-height: 420px; resize: vertical; tab-size: 4; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
.field { margin-bottom: .75rem; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  border: 1px solid currentColor; white-space: nowrap; }
.badge.ok { color: var(--accent); }
.badge.warn { color: var(--warn); }
.badge.off { color: var(--muted); }
.badge.err { color: var(--danger); }
.badge.info { color: var(--info); }

.alert { padding: .6rem .8rem; border-radius: 8px; border: 1px solid; margin: .6rem 0; font-size: .9rem; }
.alert.err { border-color: var(--danger); color: var(--danger); }
.alert.warn { border-color: var(--warn); color: var(--warn); }
.alert.info { border-color: var(--info); color: var(--info); }

/* System-Leiste */
.sysbar { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 1.25rem; }
.meter { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: .35rem; }
.meter > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.meter.warn > span { background: var(--warn); }
.meter.err > span { background: var(--danger); }

/* Server-Karten */
.server-card { display: flex; flex-direction: column; gap: .7rem; }
.server-card .head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.stats div { background: var(--panel-2); border-radius: 7px; padding: .35rem .5rem; }
.stats b { display: block; font-size: 1rem; }
.stats span { font-size: .75rem; color: var(--muted); }
.ports { font-family: var(--mono); font-size: .8rem; color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: 1rem 0; overflow-x: auto; }
.tabs a { padding: .5rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); text-decoration: none; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: var(--panel-2); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }

/* Profile */
.profile { display: flex; align-items: center; gap: .75rem; padding: .6rem .7rem; border: 1px solid var(--line);
  border-radius: 8px; margin-bottom: .5rem; background: var(--panel-2); cursor: pointer; }
label.profile { font-size: 1rem; color: var(--text); }
.profile input { width: auto; }
input.auto, select.auto { width: auto; }
textarea.short { min-height: 90px; }
label.row { color: var(--text); font-size: .9rem; margin: 0; }
.form-grid label.row { flex-wrap: nowrap; align-items: flex-start; align-self: end; }
.form-grid label.row input { margin-top: .2rem; }
.profile.current { border-color: var(--accent); }

/* Logs */
.log { background: #0a0d10; color: #cfd8e3; font: .8rem/1.4 var(--mono); padding: .75rem; border-radius: 8px;
  height: 60vh; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }

/* Konsole */
.console-input { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; background: #0a0d10;
  border: 1px solid var(--line); border-radius: 8px; padding: .35rem .5rem; color: #cfd8e3; }
.console-input input { background: transparent; border: 0; color: #cfd8e3; font-family: var(--mono); }
.console-input input:focus { outline: none; }
.console-actions { margin: .5rem 0; }

/* Profil-Editor */
.profile-form section { margin-bottom: 1rem; }
.profile-form h2 { margin-top: 0; }
.checklist { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: .25rem .5rem;
  margin-top: .4rem; background: var(--panel-2); }
.checklist label.row, .checklist .car-row { padding: .2rem 0; border-bottom: 1px solid var(--line); margin: 0; }
.checklist .mono { margin-left: auto; }
input.tiny { width: 4.5rem; padding: .2rem .35rem; }
.list-tools { flex-wrap: nowrap; margin: .4rem 0; }
.list-tools input { min-width: 8rem; }
@media (max-width: 640px) { .list-tools { flex-wrap: wrap; } }
.info-value { padding: .45rem 0; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: .75rem 0; border-top: 1px solid var(--line); }

/* Energieleiste Windows-VM */
.power-bar { margin-bottom: 1rem; }
select.small { padding: .2rem .4rem; font-size: .85rem; }

/* Verwaltung / 2FA */
img.qr { background: #fff; padding: 8px; border-radius: 8px; width: 210px; height: 210px; display: block; margin: .5rem 0; }
pre.recovery { background: var(--panel-2); padding: .6rem; border-radius: 8px; columns: 2; }

/* Upload */
.progress { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); }

/* Login */
.login { max-width: 360px; margin: 12vh auto 0; }
.login h1 { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.login img { width: 34px; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text);
  padding: 1.25rem; width: min(560px, calc(100vw - 32px)); max-height: 85vh; }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--panel);
  border: 1px solid var(--line); padding: .6rem 1rem; border-radius: 8px; z-index: 20; max-width: calc(100vw - 32px); }
.toast.err { border-color: var(--danger); color: var(--danger); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: .5rem; padding: .5rem 16px; }
  .topbar nav { order: 3; width: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
}
