/* msFaktura Server-Monitor, Version 1.1
   Leitstand in hell: kühles Weiß, Navy-Kopf, je Messgröße eine eigene Pastellfarbe. */

:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --surface-3: #e9ecf5;
  --line: #e1e5ef;
  --grid: #edf0f6;
  --text: #1b2340;
  --text-2: #4a5272;
  --muted: #7a809b;
  --brand: #0d366b;
  --brand-2: #1c5cab;
  --accent: #2a78d6;
  --focus: #2a78d6;

  /* Messgrößen: Hintergrund (pastell) und Tinte (Linie, Zahl) */
  --ram-bg: #ece8ff;     --ram: #5b47c9;
  --cpu-bg: #ffeadb;     --cpu: #c2571b;
  --commit-bg: #e2f0ff;  --commit: #1e6fc2;
  --disk-bg: #def5ea;    --disk: #17855a;
  --net-bg: #fde6f0;     --net: #b83d78;  --net-2: #1e6fc2;
  --users-bg: #fff4d2;   --users: #8a6a00;
  --mail-bg: #e5f3f7;    --mail: #1f7a8f;
  --sec-bg: #ece9f6;     --sec: #5b4f8f;

  /* Warnstufen */
  --ok-bg: #dcf5e6;      --ok: #1b7a43;      --ok-dot: #2fb36a;
  --warn-bg: #ffefc9;    --warn: #8a5a00;    --warn-dot: #f0a81a;
  --crit-bg: #ffe0dc;    --crit: #b4231c;    --crit-dot: #e2483d;
  --off-bg: #eceef3;     --off: #5b6175;     --off-dot: #9aa0b3;
  --new-bg: #e3edff;     --new: #1e5bb8;     --new-dot: #4d86e0;

  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(27, 35, 64, .05), 0 4px 14px rgba(27, 35, 64, .04);
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Display", Roboto, Arial, sans-serif;
  font-family: var(--font);
  font-size: 15px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #10131c; --surface: #181c27; --surface-2: #1f2432; --surface-3: #272d3d; --line: #2c3243; --grid: #232838;
    --text: #e9ecf5; --text-2: #b8bfd6; --muted: #858ca6;
    --brand: #0b2547; --brand-2: #7fb0ef; --accent: #5b9cf0; --focus: #7fb0ef;
    --ram-bg: #2a2550; --ram: #b7aaff;  --cpu-bg: #3a2618; --cpu: #ffb48a;  --commit-bg: #182c45; --commit: #8cc2ff;
    --disk-bg: #15342a; --disk: #7fdcae; --net-bg: #3a1d2c; --net: #ff9cc8; --net-2: #8cc2ff;
    --users-bg: #362d10; --users: #f2cf5c; --mail-bg: #163038; --mail: #85d1e2; --sec-bg: #262338; --sec: #c2b8f0;
    --ok-bg: #17352a; --ok: #7fe0a6; --warn-bg: #3a2c0e; --warn: #ffcf6e; --crit-bg: #42201d; --crit: #ff9c94;
    --off-bg: #262a36; --off: #a5abc0; --new-bg: #1a2a47; --new: #9cc0ff;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10131c; --surface: #181c27; --surface-2: #1f2432; --surface-3: #272d3d; --line: #2c3243; --grid: #232838;
  --text: #e9ecf5; --text-2: #b8bfd6; --muted: #858ca6;
  --brand: #0b2547; --brand-2: #7fb0ef; --accent: #5b9cf0; --focus: #7fb0ef;
  --ram-bg: #2a2550; --ram: #b7aaff;  --cpu-bg: #3a2618; --cpu: #ffb48a;  --commit-bg: #182c45; --commit: #8cc2ff;
  --disk-bg: #15342a; --disk: #7fdcae; --net-bg: #3a1d2c; --net: #ff9cc8; --net-2: #8cc2ff;
  --users-bg: #362d10; --users: #f2cf5c; --mail-bg: #163038; --mail: #85d1e2; --sec-bg: #262338; --sec: #c2b8f0;
  --ok-bg: #17352a; --ok: #7fe0a6; --warn-bg: #3a2c0e; --warn: #ffcf6e; --crit-bg: #42201d; --crit: #ff9c94;
  --off-bg: #262a36; --off: #a5abc0; --new-bg: #1a2a47; --new: #9cc0ff;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1 { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.2; margin: .1em 0 .5em; font-weight: 650; letter-spacing: -.015em; }
h2 { font-family: var(--font-display); font-size: 1.08rem; margin: 0 0 .75em; font-weight: 620; display: flex; align-items: center; gap: 8px; }
h3 { font-size: .95rem; margin: 0 0 .5em; font-weight: 620; display: flex; align-items: center; gap: 6px; }
code, pre { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; font-size: .88em; }
code { background: var(--surface-2); padding: .1em .4em; border-radius: 5px; }
pre.copy { background: var(--surface-2); padding: .8em 1em; border-radius: var(--radius-sm); overflow-x: auto; white-space: pre-wrap; word-break: break-all; user-select: all; margin: .5em 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
.lead { color: var(--text-2); max-width: 72ch; margin: -.2em 0 1.2em; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Symbole ---------- */
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.chip-ico { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none; }
.chip-ico .ico { width: 19px; height: 19px; }
.chip-ico.sm { width: 26px; height: 26px; border-radius: 8px; }
.chip-ico.sm .ico { width: 15px; height: 15px; }
.c-ram { background: var(--ram-bg); color: var(--ram); }
.c-cpu { background: var(--cpu-bg); color: var(--cpu); }
.c-commit { background: var(--commit-bg); color: var(--commit); }
.c-disk { background: var(--disk-bg); color: var(--disk); }
.c-net { background: var(--net-bg); color: var(--net); }
.c-users { background: var(--users-bg); color: var(--users); }
.c-mail { background: var(--mail-bg); color: var(--mail); }
.c-sec { background: var(--sec-bg); color: var(--sec); }
.c-off { background: var(--off-bg); color: var(--off); }
.c-ok { background: var(--ok-bg); color: var(--ok); }
.c-warn { background: var(--warn-bg); color: var(--warn); }
.c-crit { background: var(--crit-bg); color: var(--crit); }

/* ---------- Info-Knopf ---------- */
.info { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; border: 1.4px solid currentColor; color: var(--muted);
  font: 700 10.5px/1 Georgia, "Times New Roman", serif; font-style: italic; cursor: help; flex: none; user-select: none; vertical-align: 1px; background: transparent; padding: 0; opacity: .8; }
.info:hover, .info:focus-visible, .info.on { color: var(--brand-2); opacity: 1; }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; font-size: .84rem; line-height: 1.45; box-shadow: 0 10px 30px rgba(27, 35, 64, .16); max-width: 320px; }
.tip.text { pointer-events: none; }
.tip b { font-variant-numeric: tabular-nums; }
.tip .t { color: var(--muted); margin-bottom: 3px; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; }
.tip i.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

/* ---------- Kopf ---------- */
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 22px; padding: 0 24px; height: 58px; background: var(--brand); color: #fff; }
header.top a { color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 1.05rem; color: inherit; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.logo { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; }
.logo .dot { fill: #7be0a3; stroke: none; }
.logo .ln { stroke-linecap: round; }
header nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
header nav a { display: flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 9px; color: rgba(255, 255, 255, .82) !important; white-space: nowrap; font-size: .93rem; }
header nav a .ico { width: 16px; height: 16px; }
header nav a:hover { background: rgba(255, 255, 255, .1); text-decoration: none; color: #fff !important; }
header nav a.on { background: rgba(255, 255, 255, .17); color: #fff !important; }
header .who { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-size: .88rem; }
.who .avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .16); font-weight: 650; text-transform: uppercase; }
.who .role { color: rgba(255, 255, 255, .7); font-size: .78rem; display: block; line-height: 1.1; }
.who .nm { display: block; line-height: 1.2; }
.pill { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: #ff8a80; color: #4a0f0b; font-size: .74rem; font-weight: 700; }

main.wrap { max-width: 1320px; margin: 0 auto; padding: 24px 24px 80px; }
.bar-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.bar-head h1, .bar-head h2 { margin: 0; }
.tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.back { font-size: .9rem; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Karten, Hinweise ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; margin: 16px 0; box-shadow: var(--shadow); }
.card > h2:first-child { margin-top: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols > .card { margin: 0; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius); margin: 10px 0; background: var(--new-bg); color: var(--text); }
.note > .ico { margin-top: 2px; color: var(--new); }
.note.good { background: var(--ok-bg); } .note.good > .ico { color: var(--ok); }
.note.warn { background: var(--warn-bg); } .note.warn > .ico { color: var(--warn); }
.note.bad { background: var(--crit-bg); } .note.bad > .ico { color: var(--crit); }

/* ---------- Kennzahlen ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 6px 0 18px; }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow); display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: start; }
.kpi .chip-ico { grid-row: span 3; }
.kpi .k { font-size: .84rem; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .v { font-family: var(--font-display); font-size: 1.65rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; letter-spacing: -.01em; }
.kpi .s { font-size: .8rem; color: var(--muted); }
.kpis.dense { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpis.dense .kpi { grid-template-columns: 1fr; padding: 13px 14px; }
.kpis.dense .kpi .chip-ico { position: absolute; right: 12px; top: 12px; width: 28px; height: 28px; border-radius: 8px; }
.kpis.dense .kpi .chip-ico .ico { width: 16px; height: 16px; }
.kpis.dense .kpi .k { padding-right: 34px; }
.kpis.dense .kpi .v { font-size: 1.45rem; white-space: nowrap; }
.kpi.warn { background: linear-gradient(var(--warn-bg), var(--warn-bg)) padding-box; border-color: transparent; }
.kpi.crit { background: linear-gradient(var(--crit-bg), var(--crit-bg)) padding-box; border-color: transparent; }
.kpi.warn .v { color: var(--warn); }
.kpi.crit .v { color: var(--crit); }

/* ---------- Status ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 650; padding: 3px 10px 3px 8px; border-radius: 20px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.status.ok { color: var(--ok); background: var(--ok-bg); } .status.ok::before { background: var(--ok-dot); }
.status.warnung { color: var(--warn); background: var(--warn-bg); } .status.warnung::before { background: var(--warn-dot); }
.status.kritisch { color: var(--crit); background: var(--crit-bg); } .status.kritisch::before { background: var(--crit-dot); animation: pulse 1.6s ease-in-out infinite; }
.status.offline, .status.archiv, .status.ended { color: var(--off); background: var(--off-bg); } .status.offline::before, .status.archiv::before, .status.ended::before { background: var(--off-dot); }
.status.neu { color: var(--new); background: var(--new-bg); } .status.neu::before { background: var(--new-dot); }
.status.admin { color: var(--sec); background: var(--sec-bg); } .status.admin::before { background: var(--sec); }
.status.owner { color: var(--brand-2); background: var(--new-bg); } .status.owner::before { background: var(--brand-2); }
.status.viewer { color: var(--off); background: var(--off-bg); } .status.viewer::before { background: var(--off-dot); }
@keyframes pulse { 50% { opacity: .35; } }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; padding: 2px 9px 2px 3px; border-radius: 20px; white-space: nowrap; }
.tag .chip-ico.sm { width: 22px; height: 22px; border-radius: 50%; background: transparent; }
.tag .chip-ico.sm .ico { width: 14px; height: 14px; }

/* ---------- Serverliste ---------- */
.servers { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.srv { position: relative; display: block; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px 12px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.srv:hover { text-decoration: none; border-color: var(--brand-2); }
.srv::before { content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: transparent; }
.srv.st-warnung::before { background: var(--warn-dot); }
.srv.st-kritisch::before { background: var(--crit-dot); }
.srv.st-offline::before { background: var(--off-dot); }
.srv .hd { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.srv .nm { font-weight: 650; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv .host { color: var(--muted); font-size: .8rem; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 14px 0 8px; }
.meter .lb { display: flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--text-2); }
.meter .lb .chip-ico.sm { width: 22px; height: 22px; border-radius: 7px; }
.meter .lb .chip-ico.sm .ico { width: 13px; height: 13px; }
.meter .lb b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; font-size: .9rem; }
.meter .lb b.warn { color: var(--warn); }
.meter .lb b.crit { color: var(--crit); }
.track { position: relative; height: 7px; background: var(--surface-3); border-radius: 4px; margin-top: 5px; overflow: hidden; }
.fill { height: 100%; border-radius: 4px; }
.fill.warn { background: var(--warn-dot) !important; }
.fill.crit { background: var(--crit-dot) !important; }
.track .mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--crit-dot); opacity: .55; }
.spark-wrap { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.spark-wrap .lbl { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.spark { display: block; width: 100%; height: 30px; }
.srv .foot { display: flex; justify-content: space-between; gap: 8px; font-size: .78rem; color: var(--muted); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.srv .foot b { color: var(--text-2); }

/* ---------- Offene Warnungen ---------- */
.alerts-strip { display: grid; gap: 8px; margin: 0 0 22px; }
.alert-row { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: var(--radius); flex-wrap: wrap; color: var(--text); }
.alert-row:hover { text-decoration: none; filter: brightness(.98); }
.alert-row.l1 { background: var(--warn-bg); }
.alert-row.l2 { background: var(--crit-bg); }
.alert-row .when { color: var(--text-2); font-size: .82rem; margin-left: auto; }

/* ---------- Diagramme ---------- */
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 28px; }
.chart h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; }
.chart h3 .sum { margin-left: auto; font-weight: 500; color: var(--muted); font-size: .82rem; }
.chart svg { display: block; width: 100%; height: 190px; overflow: visible; }
.chart .legend { display: flex; gap: 14px; font-size: .76rem; color: var(--text-2); margin-top: 4px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.legend i.band { height: 9px; opacity: .3; }
.legend i.thr { height: 0; border-top: 2px dashed var(--crit-dot); background: none !important; }
.ax { font-size: 10.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.gl { stroke: var(--grid); stroke-width: 1; }
.thr-line { stroke: var(--crit-dot); stroke-width: 1.2; stroke-dasharray: 5 4; opacity: .8; }
.cross { stroke: var(--text-2); stroke-width: 1; opacity: .45; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--text-2); font-size: .79rem; border-bottom: 1px solid var(--line); padding: 7px 10px; white-space: nowrap; }
.tbl th .info { margin-left: 4px; }
.tbl td { border-bottom: 1px solid var(--grid); padding: 8px 10px; font-variant-numeric: tabular-nums; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td, .tbl tr.sel td { background: var(--surface-2); }
.tbl .hi-warn { color: var(--warn); font-weight: 650; }
.tbl .hi-crit { color: var(--crit); font-weight: 650; }
.tbl .t2 { color: var(--muted); font-size: .8rem; }
.cell-pill { display: inline-block; padding: 1px 8px; border-radius: 6px; }
.cell-pill.warn { background: var(--warn-bg); color: var(--warn); font-weight: 650; }
.cell-pill.crit { background: var(--crit-bg); color: var(--crit); font-weight: 650; }
.bar-in { display: inline-block; height: 6px; border-radius: 3px; vertical-align: middle; margin-left: 8px; background: var(--ram); opacity: .55; }

/* ---------- Formulare ---------- */
.form { display: grid; gap: 14px; }
.form label, .field { display: grid; gap: 5px; font-size: .86rem; color: var(--text-2); }
.field .lbl { display: flex; align-items: center; gap: 6px; }
label.inline { display: flex !important; align-items: center; gap: 8px; color: var(--text); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; min-width: 0; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover { border-color: #c9cfdf; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(42, 120, 214, .16); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--accent); }
input[type=search] { min-width: 250px; padding-left: 34px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a809b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px 50% / 16px; }
.with-unit { position: relative; display: flex; }
.with-unit input { width: 100%; padding-right: 46px; font-variant-numeric: tabular-nums; }
.with-unit .unit { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .84rem; pointer-events: none; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 18px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 10px; }
legend { padding: 0 6px; font-weight: 620; color: var(--text); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-size: .9rem; font-weight: 550; padding: 8px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-align: center; list-style: none; white-space: nowrap; }
.btn:hover { border-color: var(--brand-2); text-decoration: none; }
.btn .ico { width: 16px; height: 16px; }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
:root[data-theme="dark"] .btn.primary { color: #0b1530; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0b1530; } }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--crit-bg); border-color: transparent; color: var(--crit); }
.btn.danger:hover { border-color: var(--crit-dot); }
.btn.small { padding: 4px 11px; font-size: .8rem; }
.form > .btn { justify-self: start; }
.inline-form { display: inline-block; margin: 0; }
.row-actions { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
details summary::-webkit-details-marker { display: none; }
details[open] { flex-basis: 100%; }
details .form { margin-top: 10px; max-width: 520px; }

/* Umschalter */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text); font-size: .9rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .knob { position: relative; width: 38px; height: 22px; border-radius: 12px; background: var(--surface-3); transition: background .2s; flex: none; }
.switch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + .knob { background: var(--ok-dot); }
.switch input:checked + .knob::after { transform: translateX(16px); }
.switch input:focus-visible + .knob { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Segmente, Auswahlkarten */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { white-space: nowrap; font: inherit; font-size: .84rem; border: 0; background: transparent; color: var(--text-2); padding: 6px 12px; cursor: pointer; border-radius: 8px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 620; box-shadow: 0 1px 3px rgba(27, 35, 64, .12); }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.choice label { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: var(--radius); cursor: pointer; color: var(--text); background: var(--surface); }
.choice label:hover { border-color: #c9cfdf; }
.choice input { grid-row: span 2; margin-top: 3px; }
.choice b { font-weight: 620; }
.choice span { color: var(--muted); font-size: .82rem; grid-column: 2; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--new-bg); }

/* ---------- Einstellungen: Aufbau ---------- */
.settings { display: grid; grid-template-columns: 230px 1fr; gap: 28px; align-items: start; }
.snav { position: sticky; top: 80px; display: grid; gap: 2px; }
.snav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); font-size: .92rem; }
.snav a:hover { background: var(--surface); text-decoration: none; color: var(--text); }
.snav a.on { background: var(--surface); color: var(--text); font-weight: 620; box-shadow: var(--shadow); }
.snav .chip-ico.sm { width: 28px; height: 28px; }
.ssec { scroll-margin-top: 80px; margin-bottom: 34px; }
.ssec > header { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.ssec > header h2 { margin: 0; font-size: 1.22rem; }
.ssec > p.lead { margin: 4px 0 14px 46px; }

.metric { display: grid; grid-template-columns: 1fr; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 12px; box-shadow: var(--shadow); }
.metric .mh { display: flex; align-items: center; gap: 12px; }
.metric .mh h3 { margin: 0; font-size: 1rem; }
.metric .mh .sub { color: var(--muted); font-size: .82rem; }
.metric .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 12px 16px; }
.scale { position: relative; height: 34px; margin: 18px 2px 0; }
.scale .bar { position: absolute; left: 0; right: 0; top: 8px; height: 10px; border-radius: 6px; display: flex; overflow: hidden; }
.scale .bar span { height: 100%; transition: flex-basis .25s; }
.scale .z-ok { background: var(--ok-bg); }
.scale .z-warn { background: var(--warn-bg); }
.scale .z-crit { background: var(--crit-bg); }
:root:not([data-theme="dark"]) .scale .z-ok { background: #bfe9cf; }
:root:not([data-theme="dark"]) .scale .z-warn { background: #ffdc8f; }
:root:not([data-theme="dark"]) .scale .z-crit { background: #ffb8ae; }
.scale .pin { position: absolute; top: 2px; width: 2px; height: 22px; background: var(--text); border-radius: 2px; transition: left .25s; }
.scale .pin b { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); font-size: .72rem; color: var(--text-2); white-space: nowrap; font-weight: 600; }
.scale .pin.up b { top: -17px; }
.scale .ends { position: absolute; top: 22px; left: 0; right: 0; display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); }
.scale-wrap { padding-bottom: 6px; }

.savebar { position: sticky; bottom: 16px; z-index: 15; display: flex; align-items: center; gap: 14px; justify-content: space-between; background: var(--text); color: var(--surface); border-radius: 14px; padding: 10px 12px 10px 18px; box-shadow: 0 12px 30px rgba(27, 35, 64, .25); margin-top: 8px; transform: translateY(0); }
.savebar.idle { position: static; background: var(--surface); color: var(--muted); border: 1px solid var(--line); box-shadow: none; }
.savebar .btn.primary { background: #7fb0ef; border-color: #7fb0ef; color: #0b1530; }
.savebar.idle .btn.primary { background: var(--surface-2); border-color: var(--line); color: var(--muted); cursor: default; }

.stat-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.stat { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; }
.stat .k { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.stat .v { font-weight: 650; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.secret { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.secret code { padding: 6px 10px; font-size: .85rem; letter-spacing: .04em; }

/* Benutzerliste */
.users { display: grid; gap: 8px; }
.user { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.user .avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-weight: 700; text-transform: uppercase; background: var(--surface-3); color: var(--text-2); }
.user.is-admin .avatar { background: var(--sec-bg); color: var(--sec); }
.user.is-owner .avatar { background: var(--new-bg); color: var(--new); }
.user .who2 b { display: block; }
.user .who2 span { font-size: .8rem; color: var(--muted); }
.user .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.user details { grid-column: 1 / -1; }
.user details[open] summary { margin-bottom: 8px; }

/* Schritte (Agent) */
.steps { display: grid; gap: 12px; counter-reset: s; }
.step { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.step::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--new-bg); color: var(--new); font-weight: 700; }
.step b { display: block; margin-bottom: 2px; }
.plainlist { padding-left: 1.2em; display: grid; gap: 6px; margin: 0; }
.checks { list-style: none; padding: 0; display: grid; gap: 3px; }
.checks .ok { color: var(--ok); }
.checks .bad { color: var(--crit); }

/* Anmeldung, Einrichtung */
body.plain { min-height: 100vh; background: radial-gradient(1200px 500px at 50% -10%, var(--new-bg), transparent 70%), var(--bg); }
main.login { max-width: 380px; margin: 12vh auto; padding: 0 16px; }
main.login .card { padding: 26px; }
main.login .brand { color: var(--brand); margin-bottom: 22px; justify-content: center; }
:root[data-theme="dark"] main.login .brand { color: var(--brand-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) main.login .brand { color: var(--brand-2); } }
.brand.big { font-size: 1.45rem; }
.brand.big .logo { width: 36px; height: 36px; }
main.narrow { max-width: 760px; margin: 30px auto; padding: 0 16px 60px; }

@media (max-width: 980px) {
  .settings { grid-template-columns: 1fr; gap: 10px; }
  .snav { position: sticky; top: 0; z-index: 10; display: flex; overflow-x: auto; gap: 6px; padding: 8px 0; background: var(--bg); scrollbar-width: none; }
  .snav a { white-space: nowrap; background: var(--surface); border: 1px solid var(--line); padding: 5px 10px 5px 6px; }
  .snav .chip-ico.sm { width: 22px; height: 22px; }
  .ssec > p.lead { margin-left: 0; }
}
@media (max-width: 860px) {
  .charts, .cols { grid-template-columns: 1fr; }
  header.top { padding: 0 16px; gap: 12px; }
  header .who .nm, header .who .role { display: none; }
  main.wrap { padding: 16px 16px 70px; }
  .servers { grid-template-columns: 1fr; }
  input[type=search] { min-width: 0; width: 100%; }
  .user { grid-template-columns: auto 1fr; }
  .user .acts { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 560px) {
  header.top { flex-wrap: wrap; height: auto; padding: 8px 12px 0; row-gap: 4px; position: static; }
  header.top .brand { flex: 1; }
  header nav { order: 3; flex-basis: 100%; padding-bottom: 6px; }
  header nav a { padding: 6px 9px; font-size: .88rem; }
  header nav a .ico { display: none; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1; padding: 6px 4px; font-size: .8rem; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { grid-template-columns: 1fr; padding: 12px; }
  .kpi .chip-ico { display: none; }
  .kpi .v { font-size: 1.3rem; }
  .card { padding: 16px 14px; }
  .metric { padding: 14px; }
  h1 { font-size: 1.35rem; }
}
