:root {
  --blue: #1d4f91;
  --blue-deep: #163d70;
  --blue-mid: #4a78b5;
  --blue-wash: #dbe7f5;
  --yellow: #f4b400;
  --yellow-wash: #fff3c4;
  --ground: #e9eef3;
  --panel: #ffffff;
  --ink: #18222e;
  --ink-2: #44546a;
  --line: #d3dce6;
  --system: #5d6b7b;
  --green: #1c7c44;
  --red: #b3261e;
  --red-wash: #fbe4e2;
  --amber: #8f5300;
  --cpu: #1d4f91;
  --ram: #c2570c;
  --radius: 6px;
  --display: "Barlow Semi Condensed", "Bahnschrift", "DIN Alternate", sans-serif;
  --body: "Barlow", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: #a9b7c6 var(--ground); }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 1rem/1.5 var(--body); font-variant-numeric: tabular-nums; }
::selection { background: var(--yellow); color: var(--ink); }
h1, h2, h3, p { margin: 0; }
h1 { font: 700 clamp(1.75rem, 1.2rem + 2vw, 2.5rem)/1.08 var(--display); text-wrap: balance; }
h2 { font: 700 1.375rem/1.2 var(--display); }
h3 { font: 600 1.0625rem/1.3 var(--body); }
a { color: var(--blue); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 3px; }
svg.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .875rem; }
[hidden] { display: none !important; }

/* Rahmen: Seitenleiste + Arbeitsfläche */
.shell { display: grid; grid-template-columns: 15rem 1fr; min-height: 100dvh; }
.rail { background: var(--blue); color: #fff; display: flex; flex-direction: column; padding: 1.5rem 0 1rem; position: sticky; top: 0; height: 100dvh; }
.brand { padding: 0 1.5rem 1.5rem; font: 700 1.625rem/1 var(--display); }
.brand small { display: block; margin-top: .5rem; font: 500 .8125rem/1.35 var(--body); color: #c9d9ee; overflow-wrap: anywhere; }
.nav { display: flex; flex-direction: column; }
.nav a { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.5rem; color: #dbe7f5; text-decoration: none; font-weight: 500; font-size: 1.0625rem; }
.nav a:hover { background: var(--blue-deep); color: #fff; }
.nav a[aria-current="page"] { background: var(--yellow); color: var(--ink); font-weight: 700; }
.rail-foot { margin-top: auto; padding: 1rem 1.5rem 0; font-size: .8125rem; color: #c9d9ee; display: grid; gap: .5rem; }
.rail-foot button { background: none; border: 0; padding: 0; color: #fff; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; text-align: left; }
.demo-flag { background: var(--yellow); color: var(--ink); font-weight: 600; padding: .5rem 1.5rem; font-size: .8125rem; margin-bottom: .75rem; }
main { padding: 2.25rem clamp(1rem, 3vw, 2.75rem) 4rem; min-width: 0; max-width: 80rem; }
.offline { background: var(--red); color: #fff; padding: .625rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-weight: 500; }

.head { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; justify-content: space-between; align-items: flex-end; margin-bottom: 1.75rem; }
.head p { margin-top: .5rem; color: var(--ink-2); font-size: 1.0625rem; max-width: 60ch; }
.back { display: inline-flex; align-items: center; gap: .375rem; margin-bottom: .75rem; font-weight: 500; text-decoration: none; }
.section { margin-top: 2.5rem; }
.section > h2 { margin-bottom: .875rem; }
.section-head { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; align-items: center; margin-bottom: .875rem; }
.panel { background: var(--panel); border-radius: var(--radius); padding: 1.25rem; }
.stack { display: grid; gap: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .625rem; align-items: center; }

/* Knöpfe */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.75rem; padding: .5rem 1.125rem; border-radius: var(--radius); border: 1.5px solid var(--blue); background: var(--panel); color: var(--blue); font-weight: 600; cursor: pointer; text-decoration: none; transition: background-color .15s, color .15s, transform .15s var(--ease); }
.btn:hover { background: var(--blue-wash); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-deep); }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: var(--red-wash); }
.btn.danger.primary { background: var(--red); color: #fff; }
.btn.sm { min-height: 2.25rem; padding: .25rem .75rem; font-size: .9375rem; }
.btn.big { min-height: 3.25rem; padding: .75rem 1.5rem; font-size: 1.0625rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.iconbtn { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 0; border-radius: var(--radius); background: none; color: var(--blue); cursor: pointer; }
.iconbtn:hover { background: var(--blue-wash); }
.iconbtn.danger { color: var(--red); }
.iconbtn.danger:hover { background: var(--red-wash); }

/* Zustandsmarken: immer Form + Wort */
.state { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; white-space: nowrap; }
.state i { width: .75rem; height: .75rem; flex: none; }
.state.running { color: var(--green); }
.state.running i { background: currentColor; border-radius: 50%; }
.state.stopped { color: var(--ink-2); }
.state.stopped i { border: 2px solid currentColor; border-radius: 2px; }
.state.busy, .state.starting { color: var(--amber); }
.state.busy i, .state.starting i { border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .9s linear infinite; }
.state.error { color: var(--red); }
.state.error i { width: 0; height: 0; border: .4rem solid transparent; border-bottom: .72rem solid currentColor; border-top: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Die Schattenwand: Arbeitsspeicher als Plätze */
.wall-label { display: flex; flex-wrap: wrap; gap: .25rem 1rem; justify-content: space-between; font: 600 .875rem/1.3 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: .5rem; }
.wall { display: flex; gap: 2px; height: 9.5rem; background: var(--panel); padding: .5rem; border-radius: var(--radius); }
.slot { position: relative; min-width: .5rem; border-radius: 4px; overflow: hidden; background: var(--blue-mid); color: #fff; text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; padding: .625rem .75rem; transition: flex-grow .6s var(--ease); }
.slot .fill { position: absolute; inset: auto 0 0 0; background: var(--blue); transition: height .6s var(--ease); }
.slot b, .slot span { position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot b { font: 600 1.0625rem/1.2 var(--display); }
.slot span { font: 700 1.5rem/1 var(--display); }
.slot span small { font: 500 .8125rem var(--body); margin-left: .25rem; }
.slot.tight b, .slot.tight span { visibility: hidden; }
.slot.system { background: var(--system); }
.slot.free { background: var(--yellow-wash); color: var(--ink); outline: 3px dashed var(--yellow); outline-offset: -3px; }
.slot.ghost { background: var(--yellow); color: var(--ink); }
.slot.ghost.nofit { background: var(--red-wash); color: var(--red); outline: 3px dashed var(--red); outline-offset: -3px; }
a.slot:hover { filter: brightness(1.08); }
.wall-note { margin-top: .625rem; color: var(--ink-2); max-width: 75ch; }
.wall-note b { color: var(--ink); font-weight: 600; }
.wall-key { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin-top: .5rem; font-size: .875rem; color: var(--ink-2); }
.wall-key span { display: inline-flex; align-items: center; gap: .4rem; }
.wall-key i { width: .875rem; height: .875rem; border-radius: 2px; }

/* Projektzeilen mit festen Spalten */
.rows { background: var(--panel); border-radius: var(--radius); }
.prow { display: grid; grid-template-columns: 8.5rem minmax(9rem, 1.4fr) minmax(8rem, 1.3fr) 8.5rem 15.5rem; gap: 1rem; align-items: center; padding: .875rem 1.25rem; border-top: 1px solid var(--ground); }
.prow:first-child { border-top: 0; }
.prow.head-row { font: 600 .8125rem/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); padding-block: .75rem; }
.prow .name { font-weight: 600; font-size: 1.0625rem; color: var(--ink); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .name:hover { color: var(--blue); text-decoration: underline; }
.prow .kind { display: block; font-size: .875rem; color: var(--ink-2); }
.prow .addr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .acts { display: flex; gap: .375rem; justify-content: flex-end; }
.prow.is-error { background: var(--red-wash); }
.prow.is-stopped .name { color: var(--ink-2); }
.problem { grid-column: 1 / -1; color: var(--red); font-size: .9375rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { padding: 2.5rem 1.25rem; text-align: center; color: var(--ink-2); display: grid; gap: 1rem; justify-items: center; }
.empty h3 { color: var(--ink); font-size: 1.25rem; }

/* Messwerte */
.vitals { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1rem; }
.legend { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; margin-bottom: .5rem; }
.legend span { display: inline-flex; align-items: center; gap: .5rem; }
.legend i { width: 1rem; height: 3px; border-radius: 2px; }
.legend b { font-weight: 600; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 11rem; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--ink-2); font-size: 11px; font-family: var(--body); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; }
.tip { position: absolute; top: 0; pointer-events: none; background: var(--ink); color: #fff; padding: .375rem .625rem; border-radius: 4px; font-size: .8125rem; white-space: nowrap; transform: translateX(-50%); }
.facts { display: grid; gap: .875rem; align-content: start; }
.fact { display: grid; gap: .25rem; }
.fact dt { font-size: .875rem; color: var(--ink-2); }
.fact dd { margin: 0; font-weight: 600; font-size: 1.0625rem; overflow-wrap: anywhere; }
.meter { height: .5rem; background: var(--ground); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--blue); border-radius: 0 4px 4px 0; transition: width .6s var(--ease); }
.meter.warn i { background: var(--red); }

/* Katalog und Formulare */
.catalog { display: grid; gap: 2rem; }
.cat-list { background: var(--panel); border-radius: var(--radius); }
.cat-item { display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem; align-items: center; width: 100%; padding: 1rem 1.25rem; background: none; border: 0; border-top: 1px solid var(--ground); text-align: left; cursor: pointer; }
.cat-item:first-child { border-top: 0; }
.cat-item:hover { background: var(--blue-wash); }
.cat-item strong { font-size: 1.0625rem; font-weight: 600; }
.cat-item p { grid-column: 1; color: var(--ink-2); font-size: .9375rem; max-width: 60ch; }
.cat-item .need { grid-row: 1 / span 2; grid-column: 2; text-align: right; font-size: .875rem; color: var(--ink-2); white-space: nowrap; }
.cat-item .need b { display: block; font: 700 1.125rem var(--display); color: var(--ink); }
.fit { font-weight: 600; color: var(--green); }
.fit.no { color: var(--red); }
form.form { display: grid; gap: 1.25rem; max-width: 40rem; }
.field { display: grid; gap: .375rem; }
.field label, .field .label { font-weight: 600; }
.field .help { font-size: .875rem; color: var(--ink-2); }
input[type="text"], input[type="number"], input[type="password"], input[type="email"], select, textarea { width: 100%; min-height: 2.75rem; padding: .5rem .75rem; background: var(--panel); border: 1.5px solid #8a99ab; border-radius: var(--radius); caret-color: var(--blue); }
textarea { min-height: 6rem; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #5f6f83; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--yellow); outline-offset: 0; border-color: var(--blue); }
.check { display: flex; gap: .75rem; align-items: flex-start; cursor: pointer; font-weight: 600; }
.check input { width: 1.375rem; height: 1.375rem; margin: .1rem 0 0; accent-color: var(--blue); flex: none; }
.inline { display: grid; grid-template-columns: 1fr auto; gap: .5rem; }
.note { background: var(--blue-wash); border-radius: var(--radius); padding: .875rem 1rem; font-size: .9375rem; }
.note.warn { background: var(--yellow-wash); }
.note.bad { background: var(--red-wash); color: #7a1611; }
.note.good { background: #dff3e6; color: #0f4d29; }
.note code, code.copy { font-family: ui-monospace, Consolas, monospace; font-size: .875rem; background: rgba(24, 34, 46, .08); padding: .1rem .35rem; border-radius: 3px; overflow-wrap: anywhere; }

/* Reiter */
.tabs { display: flex; gap: .25rem; overflow-x: auto; margin-bottom: 1.25rem; border-bottom: 2px solid var(--line); }
.tabs button { background: none; border: 0; padding: .75rem 1rem; font-weight: 600; color: var(--ink-2); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }

/* Konsole und Logs */
.logbox { background: #101923; color: #dfe7f0; border-radius: var(--radius); padding: .875rem 1rem; height: 22rem; overflow: auto; font: .8125rem/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-color: #4a5a6c #101923; }
.logbox.short { height: 11rem; }
.logbox .mine { color: var(--yellow); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.players { display: flex; flex-wrap: wrap; gap: .5rem; }
.player { background: var(--blue-wash); border-radius: 999px; padding: .25rem .75rem; font-weight: 500; }
#term { background: #101923; border-radius: var(--radius); padding: .5rem; height: 26rem; }

/* Tabellen (Dateien, Backups, Firewall) */
.table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); }
.table th { font: 600 .8125rem/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); text-align: left; padding: .75rem 1rem; }
.table td { padding: .5rem 1rem; border-top: 1px solid var(--ground); vertical-align: middle; }
.table td.acts { text-align: right; white-space: nowrap; }
.table .fname { display: inline-flex; align-items: center; gap: .625rem; font-weight: 500; background: none; border: 0; padding: .375rem 0; cursor: pointer; text-align: left; color: var(--ink); overflow-wrap: anywhere; }
.table .fname:hover { color: var(--blue); text-decoration: underline; }
.table .fname svg { color: var(--blue); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; font-weight: 500; }
.crumbs button { background: none; border: 0; padding: .25rem .375rem; color: var(--blue); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.crumbs span { color: var(--ink-2); }
.dropbox { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; justify-content: space-between; align-items: center; padding: 1.25rem; border: 2px dashed var(--blue-mid); border-radius: var(--radius); background: var(--blue-wash); }
.dropbox > div:first-child { flex: 1 1 18rem; display: grid; gap: .25rem; }
.dropbox p { max-width: 60ch; }
.dropveil { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 1rem; background: rgba(29, 79, 145, .88); color: #fff; pointer-events: none; }
.dropveil > div { display: grid; gap: .5rem; justify-items: center; text-align: center; padding: 2.5rem 2rem; border: 3px dashed var(--yellow); border-radius: var(--radius); }
.dropveil strong { font: 600 1.75rem/1.1 var(--display); }
.dropveil .icon { width: 2.5rem; height: 2.5rem; color: var(--yellow); }
.editor textarea { min-height: 60vh; font: .875rem/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre; tab-size: 2; }

/* Dialog und Meldungen */
dialog { border: 0; border-radius: var(--radius); padding: 1.5rem; max-width: min(30rem, calc(100vw - 2rem)); color: var(--ink); box-shadow: 0 12px 40px rgba(24, 34, 46, .28); }
dialog::backdrop { background: rgba(24, 34, 46, .5); }
dialog h2 { margin-bottom: .625rem; }
dialog .row { margin-top: 1.25rem; justify-content: flex-end; }
dialog form { display: grid; gap: .875rem; }
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 50; max-width: min(26rem, calc(100vw - 2rem)); }
.toast { background: var(--ink); color: #fff; padding: .75rem 1rem; border-radius: var(--radius); box-shadow: 0 6px 20px rgba(24, 34, 46, .25); animation: rise .35s var(--ease); white-space: pre-wrap; overflow-wrap: anywhere; }
.toast.bad { background: var(--red); }
@keyframes rise { from { opacity: 0; transform: translateY(.5rem); } }

/* Anmeldung */
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.login-side { background: var(--blue); color: #fff; padding: clamp(1.5rem, 5vw, 4rem); display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; }
.login-side h1 { font-size: clamp(2.25rem, 1.5rem + 3vw, 3.75rem); }
.login-side p { color: #dbe7f5; max-width: 34ch; font-size: 1.125rem; margin-top: 1rem; }
.login-board { display: flex; gap: 4px; height: 6rem; }
.login-board i { border-radius: 4px; background: #fff; }
.login-board i.free { background: none; outline: 3px dashed var(--yellow); outline-offset: -3px; }
.login-form { display: grid; place-content: center; padding: 2rem 1rem; }
.login-form form { width: min(22rem, 100vw - 2rem); display: grid; gap: 1.125rem; }

@media (max-width: 60rem) {
  .vitals { grid-template-columns: 1fr; }
  .prow { grid-template-columns: 7.5rem 1fr auto; }
  .prow .addr, .prow .ram, .prow.head-row { display: none; }
}
@media (max-width: 46rem) {
  .shell { grid-template-columns: 1fr; padding-bottom: calc(4rem + env(safe-area-inset-bottom)); }
  .rail { position: fixed; inset: auto 0 0 0; height: auto; padding: 0 0 env(safe-area-inset-bottom); z-index: 20; flex-direction: row; }
  .brand, .rail-foot, .demo-flag { display: none; }
  .nav { flex-direction: row; width: 100%; }
  .nav a { flex: 1; flex-direction: column; gap: .125rem; padding: .5rem .125rem; font-size: .75rem; min-height: 3.75rem; justify-content: center; }
  main { padding-top: 1.25rem; }
  .mobile-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font: 700 1.25rem var(--display); color: var(--blue); }
  .wall { flex-direction: column; height: auto; }
  .slot { flex-direction: row; align-items: center; gap: .75rem; flex: none !important; min-height: calc(2.75rem + var(--share, 0) * 14rem); }
  .slot span { font-size: 1.125rem; }
  .slot.tight b, .slot.tight span { visibility: visible; }
  .slot .fill { inset: 0 auto 0 0; height: auto !important; width: var(--used, 0%); }
  .prow { grid-template-columns: 1fr; gap: .5rem; }
  .prow .acts { justify-content: flex-start; }
  .head .btn.big { width: 100%; }
  .table thead { display: none; }
  .table .hide-s { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-side { padding-block: 1.5rem; }
  .login-board { display: none; }
  #toasts { bottom: calc(4.5rem + env(safe-area-inset-bottom)); left: 1rem; }
}
@media (min-width: 46.01rem) { .mobile-top { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .state.busy i, .state.starting i { animation: none; border-right-color: currentColor; border-style: dotted; }
}
