/* Server-Monitor – Farben als Token, hell und dunkel jeweils eigens gewählt (Diagrammfarben validiert) */
:root {
  color-scheme: light;
  --bg: #f3f3f1;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e1dc;
  --grid: #ebeae6;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #6f6e68;
  --accent: #2a78d6;
  --accent-soft: #e6f0fc;
  --s1: #2a78d6;   /* Diagramm-Reihe 1 (blau) */
  --s2: #eb6834;   /* Reihe 2 (orange) */
  --s3: #1baf7a;   /* Reihe 3 (aqua) */
  --s4: #eda100;   /* Reihe 4 (gelb) */
  --good: #0ca30c;
  --warn: #fab219;
  --serious: #ec835a;
  --crit: #d03b3b;
  --good-soft: #e7f5e7;
  --warn-soft: #fdf3dc;
  --crit-soft: #fbe9e9;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 1px 3px rgba(0, 0, 0, .04);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110;
    --surface: #1a1a19;
    --surface-2: #232321;
    --border: #30302d;
    --grid: #2a2a27;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #96958c;
    --accent: #3987e5;
    --accent-soft: #1c2a3d;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --good-soft: #15291a;
    --warn-soft: #2e2512;
    --crit-soft: #331a1a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110;
  --surface: #1a1a19;
  --surface-2: #232321;
  --border: #30302d;
  --grid: #2a2a27;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #96958c;
  --accent: #3987e5;
  --accent-soft: #1c2a3d;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --good-soft: #15291a;
  --warn-soft: #2e2512;
  --crit-soft: #331a1a;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
[hidden] { display: none !important; }
a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: .92em; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.muted { color: var(--muted); }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px; }
.noscript { padding: 20px; }

/* Knöpfe & Eingaben */
.btn { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 9px;
  padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .6; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 12px; width: 100%; }
input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* Anmeldung */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 26px 24px; display: grid; gap: 8px; box-shadow: var(--shadow); }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.login-brand h1 { font-size: 22px; }
.login-brand p { margin: 0; font-size: 13.5px; }
.login-card label { font-weight: 600; font-size: 14px; margin-top: 6px; }
#login-code { letter-spacing: .3em; font-variant-numeric: tabular-nums; font-size: 18px; }
.login-card .btn { margin-top: 12px; padding: 11px; }
.login-note { font-size: 12.5px; margin: 6px 0 0; }
.form-error { margin: 6px 0 0; padding: 9px 12px; border-radius: 9px; background: var(--crit-soft); color: var(--text);
  border-left: 3px solid var(--crit); font-size: 14px; }

/* Kopf */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 6px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-name { font-weight: 700; font-size: 17px; }
.brand-host { font-family: var(--mono); font-size: 12.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); animation: pulse 2s ease-out infinite; }
.live.stale .live-dot { background: var(--warn); animation: none; }
.live.off .live-dot { background: var(--muted); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { appearance: none; border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; padding: 6px 10px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 0; }
.tabs button { appearance: none; border: 0; background: transparent; color: var(--text-2); font: inherit; font-weight: 600;
  padding: 10px 14px 11px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab-badge { font-size: 11.5px; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.tab-badge.warn { background: var(--crit); border-color: var(--crit); color: #fff; }

/* Inhalt */
.content { padding-top: 20px; padding-bottom: 40px; display: grid; gap: 18px; }
.content:focus { outline: none; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 20px; }
.section-head p { margin: 0; color: var(--muted); font-size: 14px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card > h3 { font-size: 15.5px; margin-bottom: 4px; }
.card > .sub { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h3 { font-size: 15.5px; }
.card-head .sub { color: var(--muted); font-size: 13px; }
@media (max-width: 960px) { .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); } }

/* Statuszeile */
.banner { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--border);
  border-left: 4px solid var(--good); background: var(--good-soft); }
.banner.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.banner.crit { border-left-color: var(--crit); background: var(--crit-soft); }
.banner h2 { font-size: 19px; }
.banner p { margin: 2px 0 0; color: var(--text-2); }
.banner ul { margin: 6px 0 0; padding-left: 18px; }
.icon-badge { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 16px; background: var(--good); }
.banner.warn .icon-badge { background: var(--warn); color: #3a2a00; }
.banner.crit .icon-badge { background: var(--crit); }

/* Kennzahlen-Kacheln */
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 10px; box-shadow: var(--shadow);
  display: grid; gap: 2px; min-width: 0; }
.tile-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.tile-value { font-size: 28px; font-weight: 650; letter-spacing: -.01em; line-height: 1.15; }
.tile-value small { font-size: 15px; font-weight: 600; color: var(--text-2); margin-left: 2px; }
.tile-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .spark { margin-top: 6px; height: 34px; }
.meter { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.meter.warn > i { background: var(--warn); }
.meter.crit > i { background: var(--crit); }
.meter.warn { background: color-mix(in srgb, var(--warn) 20%, var(--surface-2)); }
.meter.crit { background: color-mix(in srgb, var(--crit) 20%, var(--surface-2)); }

/* Status-Pillen: Symbol + Wort, nie nur Farbe */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--text); }
.pill i { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 800; color: #fff; background: var(--good); flex: none; }
.pill.warn i { background: var(--warn); color: #3a2a00; }
.pill.crit i { background: var(--crit); }
.pill.off i { background: var(--muted); }
.pill.info i { background: var(--accent); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.tag.known { border-color: color-mix(in srgb, var(--good) 50%, var(--border)); }
.tag.banned { border-color: color-mix(in srgb, var(--crit) 60%, var(--border)); color: var(--text); }

/* Tabellen */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.when { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-2); }
td.raw { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
tr.fresh td { animation: fresh 3s ease-out; }
@keyframes fresh { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } to { background: transparent; } }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.empty { color: var(--muted); font-size: 14px; padding: 10px 2px; margin: 0; }
.list-compact { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.list-compact li { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; border-bottom: 1px solid var(--grid); padding: 4px 0; }
.list-compact li .mono { overflow-wrap: anywhere; }
.list-compact .count { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Filterzeile */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.chip .key { width: 10px; height: 10px; border-radius: 3px; }

/* Diagramme */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart svg:focus { outline: none; }
.chart svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.baseline { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.refline { stroke: var(--muted); stroke-width: 1; shape-rendering: crispEdges; }
.reflabel { fill: var(--muted); font-size: 11px; }
.crosshair { stroke: var(--text-2); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
.series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series-area { stroke: none; opacity: .1; }
.dot { stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.bar-seg:hover, .bar-col:hover .bar-seg { filter: brightness(1.12); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); margin: 0 0 6px; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend .lk { width: 14px; height: 3px; border-radius: 2px; }
.legend .rk { width: 10px; height: 10px; border-radius: 3px; }
.chart-value { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 4px 16px rgba(0, 0, 0, .14); min-width: 140px; max-width: 280px; }
.tooltip .tt-head { color: var(--muted); font-size: 12px; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; }
.tooltip .tt-row span { color: var(--text-2); }
.tooltip .lk { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; }
.spark .spark-area { fill: var(--accent); opacity: .1; stroke: none; }
.cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.core { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.core .meter { margin-top: 4px; }
details.tableview summary { cursor: pointer; color: var(--accent); font-size: 13px; margin-top: 8px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.alert-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--grid); }
.alert-item:last-child { border-bottom: 0; }
.alert-item h4 { font-size: 14.5px; }
.alert-item p { margin: 2px 0 0; color: var(--text-2); font-size: 13.5px; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; padding-top: 6px; padding-bottom: 28px; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .brand-host { display: none; }
  .tile-value { font-size: 24px; }
  .seg button { padding: 6px 8px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot, tr.fresh td { animation: none; }
}
@media (forced-colors: active) {
  .pill i, .icon-badge { border: 1px solid CanvasText; }
}

/* Ergänzungen */
.card h4 { font-size: 14px; }
.svc-group + .svc-group { margin-top: 14px; }
.svc-group .card-head { margin-bottom: 4px; }
h4.mt { margin: 16px 0 6px; font-size: 14px; }
.pill i.kind-dot { width: 10px; height: 10px; border-radius: 3px; }
.key-sq { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: 0; }
td.sparkcell { width: 130px; min-width: 110px; }
td.sparkcell .spark { width: 120px; height: 26px; display: block; }
.rules { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.disk + .disk { margin-top: 14px; }
.disk .meter { margin-top: 2px; }
td.ip { white-space: nowrap; overflow-wrap: normal; }
td.raw .tag { margin-left: 8px; font-family: var(--font); }
.banner.info { border-left-color: var(--accent); background: var(--accent-soft); }
.banner.info .icon-badge { background: var(--accent); }
.content > div > .banner + .banner { margin-top: 12px; }
