/* Netzblick – Oberfläche
   Schrift: Barlow (DIN-artig, wie Beschriftungen an Technik) – liegt lokal bei, kein Abruf von außen.
   Farben: kühles Hellgrau + Tintenblau; Netze bekommen eigene Kabelfarben; Port-Fähnchen wie Kabeletiketten. */

@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 500; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #EEF1F4;
  --surface: #FFFFFF;
  --surface-2: #F5F7F9;
  --ink: #17212B;
  --ink-2: #4A5866;
  --ink-3: #7A8794;
  --line: #D8DEE5;
  --line-strong: #B4BECA;
  --trunk: #9AA6B3;
  --accent: #17212B;
  --accent-ink: #FFFFFF;
  --focus: #2F6FDE;
  --ok: #1E9E62;
  --ok-soft: #E3F5EC;
  --warn: #B8690A;
  --warn-soft: #FCF1DD;
  --danger: #C23B3B;
  --danger-soft: #FBE9E9;
  --flag-bg: #FFFFFF;
  --flag-ink: #17212B;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-total: var(--series-3);
  --meter: #2a78d6;
  --meter-warn: #C98500;
  --meter-crit: #D03B3B;
  --grid: #E4E9EE;
  --dot: rgba(23, 33, 43, .09);
  --shadow-1: 0 1px 2px rgba(23, 33, 43, .07);
  --shadow-2: 0 10px 34px rgba(23, 33, 43, .14), 0 2px 6px rgba(23, 33, 43, .06);
  --font: "Barlow", "Bahnschrift", "DIN Alternate", "Segoe UI", system-ui, sans-serif;
  --font-tight: "Barlow Semi Condensed", "Barlow", "Bahnschrift", "DIN Alternate", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0F151B;
  --surface: #172029;
  --surface-2: #1D2732;
  --ink: #E8EDF2;
  --ink-2: #AAB5C1;
  --ink-3: #7B8895;
  --line: #293441;
  --line-strong: #3C4959;
  --trunk: #556373;
  --accent: #E8EDF2;
  --accent-ink: #0F151B;
  --focus: #6FA1F5;
  --ok: #3CCB86;
  --ok-soft: #153526;
  --warn: #E8A33D;
  --warn-soft: #3A2B12;
  --danger: #F07474;
  --danger-soft: #3B1C1E;
  --flag-bg: #EEF1F4;
  --flag-ink: #17212B;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --meter: #3987e5;
  --meter-warn: #E0A83A;
  --meter-crit: #EE6B6B;
  --grid: #26313D;
  --dot: rgba(232, 237, 242, .07);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 14px 40px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
#app { min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.45 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-tight); font-weight: 600; margin: 0; letter-spacing: .005em; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- Bedienelemente ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.12); }
:root[data-theme="dark"] .btn-primary:hover { filter: brightness(.92); }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-small { height: 32px; padding: 0 12px; font-size: 14px; }
.btn-icon { width: 38px; padding: 0; }

.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-weight: 500; font-size: 14px; color: var(--ink-2); }
.field .help { font-size: 13px; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface);
}
.select { padding-right: 30px; }
.textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--focus); margin: 0; }
.error-text { color: var(--danger); font-weight: 500; }
.ok-text { color: var(--ok); font-weight: 500; }
.banner { padding: 10px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-weight: 500; }

.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- Anmeldung ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(340px, 480px) 1fr; }
.auth-panel { background: var(--surface); padding: 56px 56px 40px; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-tight); font-weight: 600; font-size: 20px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: var(--surface); display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; }
.auth-form { margin: auto 0; display: grid; gap: 18px; padding: 40px 0; }
.auth-form h1 { font-size: 34px; line-height: 1.1; }
.auth-form .lead { color: var(--ink-2); max-width: 34ch; margin-bottom: 6px; }
.auth-form .btn { height: 44px; }
.auth-foot { color: var(--ink-3); font-size: 13px; }
.auth-art { position: relative; overflow: hidden; background-color: var(--bg); background-image: radial-gradient(var(--dot) 1.2px, transparent 1.4px); background-size: 22px 22px; display: grid; place-items: center; padding: 40px; }
.auth-art svg { width: min(100%, 880px); height: auto; }
.art-line { fill: none; stroke-width: 2; stroke-linecap: round; }
.art-solid { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .9s ease-out forwards; }
.art-wifi { stroke-dasharray: 7 6; opacity: 0; animation: appear .5s ease-out forwards; }
.art-node { opacity: 0; animation: appear .45s ease-out forwards; }
.art-node rect { fill: var(--surface); stroke: var(--line-strong); }
.art-node text { fill: var(--ink); font: 600 13px var(--font-tight); }
.art-node .sub { fill: var(--ink-3); font: 400 11px var(--font); }
.art-flag rect { fill: var(--flag-bg); stroke: var(--line-strong); }
.art-flag text { fill: var(--flag-ink); font: 600 10px var(--font-tight); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: 1; } }

/* ---------- Grundgerüst ---------- */
.app { height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.topbar { display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 58px; background: var(--surface); border-bottom: 1px solid var(--line); }
.nav { display: flex; gap: 4px; align-self: stretch; }
.nav a { display: inline-flex; align-items: center; padding: 0 14px; text-decoration: none; font-weight: 500; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.scan-info { text-align: right; line-height: 1.25; min-width: 0; }
.scan-info strong { font-weight: 600; display: block; white-space: nowrap; }
.scan-info span { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.new-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 14px; border: 0; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--ink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.main { position: relative; min-height: 0; overflow: hidden; }
.page { height: 100%; overflow: auto; }
.demo-note { background: var(--warn-soft); color: var(--warn); font-weight: 500; font-size: 13px; padding: 2px 10px; border-radius: 6px; white-space: nowrap; }

/* ---------- Mesh ---------- */
.mesh { height: 100%; display: grid; grid-template-columns: 272px minmax(0, 1fr); }
.tray { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tray-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.tray-head h2 { font-size: 16px; display: flex; justify-content: space-between; gap: 8px; }
.tray-head h2 span { color: var(--ink-3); font-weight: 500; }
.tray-head p { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.tray-list { overflow: auto; padding: 8px; display: grid; gap: 4px; align-content: start; flex: 1; }
.tray.drop-target { outline: 2px dashed var(--focus); outline-offset: -6px; }
.tray-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: grab; text-align: left; width: 100%; }
.tray-item:hover, .tray-item.selected { background: var(--surface-2); border-color: var(--line); }
.tray-item .name { font-family: var(--font-tight); font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-item .sub { font-size: 12.5px; color: var(--ink-3); line-height: 1.2; }
.tray-item .text { min-width: 0; flex: 1; display: grid; }
.tray-empty { padding: 18px 16px; color: var(--ink-3); font-size: 14px; }

.viewport { position: relative; overflow: hidden; touch-action: none; cursor: grab; background-color: var(--bg); background-image: radial-gradient(var(--dot) 1.2px, transparent 1.4px); background-size: 22px 22px; }
.viewport.panning { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.world > svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.wire { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wire-trunk { stroke: var(--trunk); }
.wire-wlan { stroke-dasharray: 7 6; }
.wire-virtual { stroke-dasharray: 1.5 5; }
.wire-off { stroke: var(--line-strong) !important; }

.node {
  position: absolute; display: flex; align-items: center; gap: 10px;
  padding: 0 10px 0 12px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--line); border-left: 4px solid var(--net, var(--line-strong));
  box-shadow: var(--shadow-1); cursor: pointer; user-select: none; text-align: left;
}
.node:hover { border-color: var(--line-strong); border-left-color: var(--net, var(--line-strong)); }
.node.selected { outline: 2px solid var(--focus); outline-offset: 1px; }
.node.drop-target { outline: 2px dashed var(--focus); outline-offset: 2px; }
.node.offline { background: var(--surface-2); box-shadow: none; }
.node.offline .node-name, .node.offline > .icon { color: var(--ink-3); }
.node.dim { opacity: .28; }
.node > .icon { width: 22px; height: 22px; color: var(--ink-2); }
.node-text { min-width: 0; flex: 1; display: grid; }
.node-name { font-family: var(--font-tight); font-weight: 600; font-size: 15.5px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-sub { font-size: 12.5px; line-height: 1.25; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); flex: none; }
.state.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.tag-new { font-size: 11.5px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 4px; padding: 0 5px; margin-left: 6px; }
.node-toggle { height: 22px; min-width: 26px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.node-toggle:hover { border-color: var(--line-strong); }

/* Port-Fähnchen: sehen aus wie die weißen Etiketten an Patchkabeln */
.flag { position: absolute; transform: translate(-50%, -50%); padding: 0 6px; height: 18px; line-height: 16px; border-radius: 3px; background: var(--flag-bg); color: var(--flag-ink); border: 1px solid var(--line-strong); font: 600 11.5px/16px var(--font-tight); white-space: nowrap; pointer-events: none; }
.flag.soft { background: var(--bg); color: var(--ink-3); border-color: transparent; font-weight: 500; }

.mesh-tools { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 6px; }
.mesh-tools .btn { background: var(--surface); box-shadow: var(--shadow-1); }
.legend { position: absolute; left: 16px; bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-1); padding: 10px 12px; display: grid; gap: 8px; font-size: 13px; max-width: calc(100% - 200px); }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); white-space: nowrap; }
.legend-item svg { width: 30px; height: 6px; }
.legend-item svg path { stroke: var(--ink-2); stroke-width: 2; fill: none; stroke-linecap: round; }
.net-btn { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 9px; border-radius: 13px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-weight: 500; }
.net-btn[aria-pressed="true"] { border-color: var(--ink); background: var(--surface-2); }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--net); }
.mesh-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; pointer-events: none; }
.mesh-empty div { max-width: 44ch; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; box-shadow: var(--shadow-1); pointer-events: auto; }
.mesh-empty h2 { font-size: 20px; margin-bottom: 6px; }
.mesh-empty p { color: var(--ink-2); }

/* ---------- Geräte-Schublade ---------- */
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(400px, 100%); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-2); display: flex; flex-direction: column; z-index: 5; animation: slide .16s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; gap: 12px; align-items: flex-start; padding: 18px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.drawer-head .icon { width: 30px; height: 30px; color: var(--ink-2); margin-top: 2px; }
.drawer-head h2 { font-size: 21px; line-height: 1.2; overflow-wrap: anywhere; }
.drawer-head .status { font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.drawer-head .grow { flex: 1; min-width: 0; }
.drawer-body { overflow: auto; padding: 18px 20px 24px; display: grid; gap: 22px; align-content: start; flex: 1; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts small { display: block; color: var(--ink-3); font-size: 12.5px; line-height: 1.35; margin-top: 2px; }
.section-title { font-size: 15px; margin-bottom: 8px; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.history li { display: flex; gap: 12px; }
.history time { color: var(--ink-3); min-width: 118px; }

/* ---------- Geräteliste ---------- */
.list-page { padding: 24px 28px 40px; max-width: 1400px; margin: 0 auto; }
.list-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.list-head h1 { font-size: 26px; margin-right: auto; }
.list-head .input { width: 260px; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: auto; }
table.devices { width: 100%; border-collapse: collapse; }
.devices th { text-align: left; font-weight: 500; font-size: 13.5px; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.devices th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.devices th button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.devices td { padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.devices tbody tr { cursor: pointer; }
.devices tbody tr:last-child td { border-bottom: 0; }
.devices tbody tr:hover td, .devices tbody tr.selected td { background: var(--surface-2); }
.devices .cell-name { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.devices .cell-name strong { font-family: var(--font-tight); font-weight: 600; font-size: 15.5px; }
.devices .offline td { color: var(--ink-3); }
.net-pill { display: inline-flex; align-items: center; gap: 7px; }
.empty-row td { text-align: center; color: var(--ink-3); padding: 36px 14px; cursor: default; }

/* ---------- Einstellungen ---------- */
.settings { padding: 24px 28px 40px; max-width: 860px; margin: 0 auto; display: grid; gap: 20px; }
.settings > h1 { font-size: 26px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; display: grid; gap: 16px; }
.card h2 { font-size: 19px; }
.card > p { color: var(--ink-2); max-width: 70ch; }
.hints-area { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace; font-size: 13px; min-height: 260px; white-space: pre; overflow: auto; tab-size: 2; }
.code { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow: auto; white-space: pre; line-height: 1.6; }
.row-list { display: grid; gap: 8px; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; flex-wrap: wrap; }
.row-item .grow { flex: 1; min-width: 160px; }
.row-item .sub { font-size: 13px; color: var(--ink-3); }
.row-item input[type="color"] { width: 38px; height: 34px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.row-item .input { width: 200px; height: 36px; }
.savebar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); }
.savebar-inner { max-width: 860px; margin: 0 auto; padding: 12px 28px; display: flex; gap: 14px; align-items: center; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Balken (Anteile) ---------- */
.meter { --m: var(--meter); display: block; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--m) 18%, var(--surface)); overflow: hidden; min-width: 40px; }
.meter.warn { --m: var(--meter-warn); }
.meter.crit { --m: var(--meter-crit); }
.meter.off { background: var(--surface-2); border: 1px solid var(--line); }
.meter-fill { display: block; height: 100%; min-width: 2px; border-radius: 4px; background: var(--m); transition: width .4s ease; }
.meter.mini { display: inline-block; width: 30px; min-width: 30px; height: 5px; border-radius: 3px; vertical-align: middle; }
.meter-list { display: grid; gap: 10px; }
.meter-row { display: grid; grid-template-columns: 96px minmax(60px, 1fr) 52px; column-gap: 12px; align-items: center; font-size: 14px; }
.meter-label { color: var(--ink-2); font-weight: 500; }
.meter-label strong { display: block; color: var(--ink); font-family: var(--font-tight); font-weight: 600; font-size: 15px; line-height: 1.2; }
.meter-label small { color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
.meter-value { text-align: right; font-weight: 600; }
.meter-detail { grid-column: 2 / -1; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.meter-list.wide .meter-row { grid-template-columns: minmax(140px, 220px) minmax(80px, 1fr) 52px minmax(200px, auto); }
.meter-list.wide .meter-detail { grid-column: auto; margin: 0; font-size: 13px; text-align: right; white-space: nowrap; }
.bad-text { color: var(--danger) !important; font-weight: 500; }

/* Auslastung an den Servern im Mesh: zwei schmale Spalten, Zahl oben, Balken darunter */
.node-load { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; margin-top: 1px; font-size: 11.5px; line-height: 1.2; color: var(--ink-3); white-space: nowrap; }
.load-bit { display: grid; grid-template-columns: auto 1fr; column-gap: 4px; row-gap: 2px; align-items: baseline; min-width: 0; }
.load-label { font-family: var(--font-tight); font-weight: 600; letter-spacing: .02em; }
.load-value { color: var(--ink-2); font-weight: 500; text-align: right; }
.load-bit .meter.mini { grid-column: 1 / -1; width: 100%; min-width: 0; height: 4px; display: block; }

/* ---------- Hardware ---------- */
.hw { padding: 24px 28px 48px; max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.hw-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.hw-head h1 { font-size: 26px; }
.hw-stamp { font-size: 13.5px; margin-right: auto; }
.hw-filters { display: flex; flex-wrap: wrap; gap: 10px; min-width: 0; max-width: 100%; }
.hw-notice { display: grid; gap: 10px; }
.hw-notice:empty, .hw-sensors:empty, .hw-charts:empty, .hw-nodes:empty { display: none; }
.hw-hint { color: var(--ink-2); font-size: 14px; }
.hw-setup { max-width: 720px; }
.hw-title { font-size: 19px; margin-bottom: 12px; }
.hw-sensors { display: grid; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.kpi-label { font-size: 13.5px; color: var(--ink-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-value { font-family: var(--font-tight); font-weight: 600; font-size: 32px; line-height: 1.05; font-variant-numeric: normal; letter-spacing: -.005em; }
.kpi-sub { font-size: 13px; color: var(--ink-3); }
.hw-nodes { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.hw-node { align-content: start; }
.hw-node.off { background: var(--surface-2); }
.hw-node-head { display: flex; align-items: center; gap: 12px; }
.hw-node-head .icon { width: 24px; height: 24px; color: var(--ink-2); }
.hw-node-head .grow { flex: 1; min-width: 0; }
.hw-node-head .sub { font-size: 13px; color: var(--ink-3); }
.key-line { display: inline-block; width: 14px; height: 3px; border-radius: 2px; flex: none; }
.key-line.tall { width: 4px; height: 34px; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 13px; font-weight: 500; border: 1px solid var(--line); white-space: nowrap; }
.pill.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.hw-facts { border-top: 1px solid var(--line); padding-top: 14px; font-size: 13.5px; }
.hw-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; transition: opacity .15s; }
.hw-charts.stale { opacity: .45; }
.chart { gap: 10px; min-width: 0; padding: 18px 20px 14px; }
.chart-head { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: flex-start; justify-content: space-between; }
.chart-head h3 { font-size: 16.5px; }
.chart-note { font-size: 12.5px; color: var(--ink-3); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); }
.key { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.key strong { color: var(--ink); font-weight: 600; }
.plot { position: relative; min-width: 0; }
.chart-svg { display: block; width: 100%; height: auto; border-radius: 6px; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .tick { font: 400 11.5px var(--font); fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart-svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .area { opacity: .1; stroke: none; }
.chart-svg .dot { stroke: var(--surface); stroke-width: 2; }
.chart-svg .cross { stroke: var(--line-strong); stroke-width: 1; }
.chart-empty { color: var(--ink-3); padding: 28px 0; text-align: center; font-size: 14px; }
.tip { position: absolute; top: 6px; z-index: 2; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow-2); padding: 8px 10px; font-size: 13px; display: grid; gap: 3px; white-space: nowrap; }
.tip-time { color: var(--ink-3); font-size: 12px; }
.tip-row { display: flex; align-items: center; gap: 7px; color: var(--ink-2); }
.tip-row strong { color: var(--ink); font-weight: 600; min-width: 44px; }
.chart-table { font-size: 13px; color: var(--ink-2); }
.chart-table summary { cursor: pointer; width: max-content; color: var(--ink-3); }
.chart-table .table-scroll { max-height: 240px; overflow: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; }
.chart-table table { border-collapse: collapse; width: 100%; }
.chart-table th, .chart-table td { text-align: right; padding: 5px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.chart-table th { position: sticky; top: 0; background: var(--surface-2); font-weight: 500; color: var(--ink-3); }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.hw-table tbody tr { cursor: default; }
.hw-table .num { text-align: right; }
.hw-table th.num button { justify-content: flex-end; }
.hw-table .cell-name .icon { color: var(--ink-3); }
.cell-meter { display: inline-grid; grid-template-columns: 90px 46px; column-gap: 10px; align-items: center; text-align: right; }
.cell-meter small { grid-column: 1 / -1; color: var(--ink-3); font-size: 12px; line-height: 1.2; }

/* Sensor-Auswahl in den Einstellungen */
.picker { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.picker-head { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.picker-head .input { height: 36px; flex: 1; }
.picker-list { max-height: 300px; overflow: auto; display: grid; }
.picker-item { display: flex; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.picker-item:last-child { border-bottom: 0; }
.picker-item:hover { background: var(--surface-2); }
.picker-item .grow { flex: 1; min-width: 0; }
.picker-item strong { font-weight: 500; }
.picker-item .sub { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.picker-value { color: var(--ink-2); white-space: nowrap; }
.picker-none { padding: 18px 12px; }

/* ---------- Meldungen ---------- */
#toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 20; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-2); display: flex; gap: 14px; align-items: center; font-weight: 500; animation: appear .15s ease-out forwards; }
.toast button { all: unset; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.toast.bad { background: var(--danger); color: #fff; }

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { padding: 32px 24px; border-right: 0; }
  .topbar { height: auto; flex-wrap: wrap; gap: 4px 12px; padding: 8px 14px 0; }
  .nav { order: 3; width: 100%; height: 40px; overflow-x: auto; }
  .scan-info span { display: none; }
  .topbar-right { flex-wrap: wrap; row-gap: 6px; }
  .mesh { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .tray { order: 2; border-right: 0; border-top: 1px solid var(--line); max-height: 34vh; }
  .legend { display: none; }
  .list-page, .settings { padding-left: 14px; padding-right: 14px; }
  .savebar-inner { padding-left: 14px; padding-right: 14px; }
  .list-head .input { width: 100%; }
  .two { grid-template-columns: 1fr; }
  .hw { padding: 18px 16px 40px; }
  .hw-nodes, .hw-charts { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .kpi-value { font-size: 27px; }
  .seg button { padding: 0 10px; }
  .meter-list.wide .meter-row { grid-template-columns: minmax(110px, 1fr) minmax(60px, 1fr) 52px; }
  .meter-list.wide .meter-detail { grid-column: 1 / -1; text-align: left; margin-top: 2px; white-space: normal; }
}
@media (max-width: 520px) {
  /* Kopfzeile in drei Reihen: Marke + Symbole, Scan-Status, Bereiche */
  .topbar-right { display: contents; }
  .topbar-right .btn-icon { order: 1; }
  .topbar > .brand { margin-right: auto; }
  .topbar::before { content: ""; order: 2; width: 100%; }
  .topbar-right .new-chip, .scan-info, .topbar-right .btn-small:not(.btn-icon) { order: 3; }
  .topbar-right .demo-note { display: none; }
  .scan-info { margin-right: auto; text-align: left; }
  .nav { order: 4; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
