:root {
  --bg: #0a0e15;
  --panel: #121823;
  --panel-2: #171f2d;
  --line: #222c3c;
  --text: #e6ebf3;
  --muted: #8b97ab;
  --brand: #3b82f6;
  --up: #22c55e;
  --down: #ef4444;
  --warn: #f59e0b;
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(900px 500px at -10% 30%, rgba(59,130,246,.13), transparent 60%),
    radial-gradient(900px 500px at 110% 60%, rgba(239,68,68,.10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: inherit; }
.hidden { display: none !important; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 12px 24px;
  background: rgba(10,14,21,.82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: .2px; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); position: relative; flex: none; }
.logo::after { content: ""; position: absolute; inset: 8px 7px; border-top: 3px solid #fff; border-bottom: 3px solid #fff; }
.logo.big { width: 48px; height: 48px; margin: 0 auto 6px; }
.logo.big::after { inset: 14px 12px; }
.tabs { display: flex; gap: 4px; background: var(--panel); padding: 4px; border-radius: 10px; border: 1px solid var(--line); }
.tabs button {
  background: none; border: 0; color: var(--muted); padding: 6px 14px; border-radius: 7px;
  font: inherit; font-weight: 550; cursor: pointer;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
#search {
  width: 240px; background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 7px 12px; font: inherit; outline: none;
}
#search:focus { border-color: var(--brand); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); cursor: pointer; font-size: 16px;
}
.icon-btn:hover { border-color: var(--brand); }
.icon-btn.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Summary */
.summary { display: flex; gap: 12px; padding: 18px 24px 0; flex-wrap: wrap; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 16px; min-width: 170px;
}
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .value small { color: var(--muted); font-weight: 500; font-size: 14px; }
.stat.bad .value { color: var(--down); }

main { padding: 8px 24px 48px; }
.tab { display: none; }
.tab.active { display: block; }

/* Gruppen & Kacheln */
.group { margin-top: 22px; }
.group > h2, .section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted);
  margin: 0 0 10px; font-weight: 650; display: flex; align-items: center; gap: 8px;
}
.count { background: var(--panel-2); border-radius: 99px; padding: 0 7px; font-size: 11px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.tile {
  --accent: var(--brand);
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .12s, border-color .12s, background .12s;
  overflow: hidden;
}
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.tile:hover, .tile.kbd { transform: translateY(-2px); border-color: var(--accent); background: var(--panel-2); }
.ico {
  width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent, var(--brand)) 16%, transparent);
  font-weight: 700; font-size: 18px; color: var(--accent, var(--brand));
}
.ico img { width: 28px; height: 28px; object-fit: contain; }
.ico.sm { width: 28px; height: 28px; border-radius: 7px; font-size: 13px; }
.ico.sm img { width: 20px; height: 20px; }
.tile-text { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.tile-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-desc { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .ms { position: absolute; right: 12px; bottom: 7px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }

.dot { display: inline-block; vertical-align: middle; width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--muted); }
.tile .dot { align-self: flex-start; margin-top: 2px; }
.dot.up, .dot.running { background: var(--up); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.dot.down, .dot.stopped, .dot.exited, .dot.dead { background: var(--down); box-shadow: 0 0 0 3px rgba(239,68,68,.18); }
.dot.paused, .dot.restarting, .dot.created { background: var(--warn); }
.dot.pending { background: var(--muted); animation: pulse 1.2s ease-in-out infinite; }
.dot.none { background: transparent; border: 1px solid var(--line); }
@keyframes pulse { 50% { opacity: .3; } }

/* Panels (Proxmox / Docker) */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 18px; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-head .meta { color: var(--muted); font-size: 12px; }
.panel-head .spacer { flex: 1; }
.panel-error { padding: 14px 16px; color: #fca5a5; }
.nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.node { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.node-title { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 6px; }
.node-title .meta { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
.meter { display: grid; grid-template-columns: 38px 1fr 118px; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.meter .val { text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.bar > i.hi { background: var(--warn); }
.bar > i.crit { background: var(--down); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 12px; text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; border-bottom: 1px solid var(--line); }
tbody tr { border-bottom: 1px solid rgba(34,44,60,.6); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.02); }
table.ct { table-layout: fixed; }
table.ct td { overflow: hidden; text-overflow: ellipsis; }
table.ct .c-dot { width: 40px; } table.ct .c-name { width: 34%; } table.ct .c-status { width: 20%; } table.ct .c-ports { width: 16%; }
table.ct .c-act { width: 260px; }
td.num { font-variant-numeric: tabular-nums; color: var(--muted); }
td.name { font-weight: 600; }
td.name small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.mini { display: inline-flex; align-items: center; gap: 6px; }
.mini .bar { width: 54px; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); margin-right: 4px; }
.kind { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; }
.kind.lxc { background: rgba(59,130,246,.15); color: #93c5fd; }
.kind.qemu { background: rgba(168,85,247,.15); color: #d8b4fe; }
.ports a { color: #93c5fd; text-decoration: none; margin-right: 6px; font-variant-numeric: tabular-nums; }
.ports a:hover { text-decoration: underline; }

details.project > summary {
  list-style: none; cursor: pointer; padding: 9px 16px; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.015); border-bottom: 1px solid var(--line); font-weight: 600;
}
details.project > summary::-webkit-details-marker { display: none; }
details.project > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.project[open] > summary::before { transform: rotate(90deg); }
details.project > summary .meta { color: var(--muted); font-weight: 400; font-size: 12px; }
.endpoint-title { padding: 10px 16px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }

/* Buttons */
.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 4px 10px; border-radius: 7px; font: inherit; font-size: 12px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); }
.btn.go:hover { border-color: var(--up); color: #86efac; }
.btn.danger:hover, .btn.danger.solid { border-color: var(--down); color: #fca5a5; }
.btn:disabled, .btn.busy { opacity: .5; pointer-events: none; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty { color: var(--muted); padding: 40px 0; text-align: center; }
.empty code { background: var(--panel); padding: 2px 6px; border-radius: 5px; }

/* Dialog, Toasts, Login */
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; max-width: 420px; width: calc(100% - 32px);
}
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
dialog p { margin: 0 0 18px; font-size: 15px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dialog-actions .btn { padding: 7px 14px; font-size: 14px; }
.dialog-actions .btn.danger { border-color: var(--down); background: rgba(239,68,68,.15); color: #fecaca; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  padding: 10px 14px; border-radius: 9px; max-width: 360px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
  animation: in .2s ease-out;
}
.toast.ok { border-left-color: var(--up); }
.toast.err { border-left-color: var(--down); }
@keyframes in { from { transform: translateY(8px); opacity: 0; } }

.login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); padding: 16px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.login-card input { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 10px 12px; font: inherit; }
.login-card .btn { justify-content: center; padding: 10px; font-size: 14px; }
.login-error { color: #fca5a5; margin: 0; min-height: 1em; font-size: 13px; }

@media (max-width: 760px) {
  table.ct { table-layout: auto; }
  .top { padding: 10px 16px; gap: 10px; }
  .tools { margin-left: 0; width: 100%; }
  #search { flex: 1; width: auto; }
  .tabs { order: 3; width: 100%; }
  .tabs button { flex: 1; }
  .summary, main { padding-left: 16px; padding-right: 16px; }
  .stat { min-width: 0; flex: 1 1 140px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .tile { padding: 10px; gap: 10px; }
  .ico { width: 34px; height: 34px; }
}
@media (max-width: 420px) { .grid { grid-template-columns: 1fr; } }

/* Web: KeyHelp & WordPress */
.badge { display: inline-block; font: inherit; font-size: 12px; padding: 1px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.badge.ok { color: #86efac; border-color: rgba(34,197,94,.3); background: rgba(34,197,94,.08); }
.badge.warn { color: #fcd34d; border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.1); }
.badge.bad { color: #fca5a5; border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.1); }
button.badge { cursor: pointer; }
.muted { color: var(--muted); }
tr.detail td { padding-top: 0; white-space: normal; }
.upd { display: inline-block; margin: 0 14px 6px 0; font-size: 13px; }
.kvs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; border-bottom: 1px dashed var(--line); padding: 3px 0; }
.kv span { color: var(--muted); text-transform: capitalize; }
.kv b { font-weight: 550; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dom-head { padding: 10px 16px; cursor: pointer; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.dom-head .meta { color: var(--muted); font-weight: 400; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 14px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); text-decoration: none; }
.chip:hover { border-color: var(--brand); }
.chip.sub { color: var(--muted); }
.chip.off { opacity: .45; text-decoration: line-through; }

/* Einstellungen */
body.in-settings .summary { display: none; }
.settings { display: grid; grid-template-columns: 190px 1fr; gap: 20px; margin-top: 18px; padding-bottom: 70px; }
.set-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 76px; align-self: start; }
.set-nav button { text-align: left; background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: 8px; font: inherit; font-weight: 550; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.set-nav button:hover { color: var(--text); background: var(--panel); }
.set-nav button.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); }
.set-body { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.s-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.s-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.s-card-head .meta { color: var(--muted); font-size: 12px; }
.s-sub { margin: 8px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.item-btns { margin-left: auto; display: flex; gap: 6px; }
.btn.icon { width: 30px; justify-content: center; padding: 4px 0; }
.btn:disabled { opacity: .3; }
.btn.add { align-self: flex-start; padding: 7px 14px; font-size: 13px; border-style: dashed; }
.s-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f.wide, .f-check.wide { grid-column: 1 / -1; }
.f > span { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.f small { color: var(--muted); font-size: 11px; }
.f em { font-style: normal; font-size: 11px; padding: 0 6px; border-radius: 5px; }
.f em.set { color: #86efac; background: rgba(34,197,94,.1); }
.f em.unset { color: var(--muted); background: var(--panel-2); }
.f input, .f textarea, .svc-row input, .group-name {
  background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 8px;
  padding: 8px 10px; font: inherit; outline: none; min-width: 0; width: 100%;
}
.f textarea { resize: vertical; font-family: ui-monospace, monospace; font-size: 13px; }
.f input:focus, .f textarea:focus, .svc-row input:focus, .group-name:focus { border-color: var(--brand); }
.f-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.f-check input { width: 16px; height: 16px; accent-color: var(--brand); }
.pw { position: relative; display: flex; }
.pw input { padding-right: 38px; font-family: ui-monospace, monospace; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 14px; padding: 4px; }
.test-line { margin-top: 12px; font-size: 13px; color: var(--muted); padding: 8px 10px; border-radius: 8px; background: var(--panel-2); }
.test-line.ok { color: #86efac; background: rgba(34,197,94,.08); }
.test-line.err { color: #fca5a5; background: rgba(239,68,68,.08); }
.s-text { color: var(--muted); font-size: 13px; line-height: 1.7; }
details.help { background: rgba(59,130,246,.06); border: 1px solid rgba(59,130,246,.25); border-radius: 10px; padding: 8px 14px; font-size: 13px; }
details.help summary { cursor: pointer; color: #93c5fd; font-weight: 600; }
details.help div { margin-top: 8px; color: var(--muted); line-height: 1.6; }
details.help pre { background: var(--bg); padding: 8px 10px; border-radius: 6px; overflow-x: auto; color: var(--text); font-size: 12px; }
details.help a { color: #93c5fd; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.empty.small { padding: 16px 0; }
.group-name { font-weight: 650; width: auto; flex: 0 1 260px; }
.svc-head, .svc-row { display: grid; grid-template-columns: 34px 1.1fr 1.5fr .8fr 40px 1fr .8fr .9fr 104px; gap: 6px; align-items: center; }
.svc-head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 0 0 4px; }
.svc-row { padding: 3px 0; }
.svc-row input { padding: 6px 8px; font-size: 13px; }
.svc-row input[type=color] { padding: 2px; height: 32px; cursor: pointer; }
.svc-ico .ico { width: 30px; height: 30px; border-radius: 8px; font-size: 13px; }
.svc-ico .ico img { width: 20px; height: 20px; }
.svc-btns { display: flex; gap: 4px; }
.s-card > .btn.add { margin-top: 8px; }
.savebar {
  position: fixed; left: 50%; bottom: 16px; transform: translate(-50%, 140%); transition: transform .2s;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; z-index: 40;
  background: var(--panel-2); border: 1px solid var(--warn); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.savebar.show { transform: translate(-50%, 0); }
.savebar span { color: #fcd34d; font-weight: 600; margin-right: 8px; }
.savebar .btn { padding: 7px 16px; font-size: 14px; }
@media (max-width: 900px) {
  .settings { grid-template-columns: 1fr; }
  .set-nav { flex-direction: row; overflow-x: auto; position: static; }
  .set-nav button { white-space: nowrap; }
  .s-grid { grid-template-columns: 1fr; }
  .svc-head { display: none; }
  .svc-row { grid-template-columns: 34px 1fr 1fr; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .item-btns { margin-left: 0; }
}
.s-card.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,.25); } }
td.name small.wp-err { color: #fca5a5; white-space: normal; max-width: 420px; }
button.chip { font: inherit; font-size: 12px; color: var(--text); cursor: pointer; }
button.chip:hover { border-color: var(--up); color: #86efac; }
pre.cmd { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; font-size: 12px; overflow-x: auto; user-select: all; white-space: pre; }
.scan-hint { padding: 10px 16px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.pt-select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; font: inherit; font-size: 12px; }
.offline { position: sticky; top: 0; z-index: 60; background: #7f1d1d; color: #fee2e2; padding: 10px 24px; font-size: 14px; }

.svc-group { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 6px; font: inherit; font-size: 13px; min-width: 0; width: 100%; }
.svc-ico.drag { cursor: grab; }
.svc-row.dragging { opacity: .35; }
.svc-row.drop-before { box-shadow: inset 0 3px 0 var(--brand); }
.svc-group-card.drop-into { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(59,130,246,.25); }
