:root {
  --bg: #f4f5f7; --panel: #ffffff; --ink: #1d2230; --muted: #6b7280; --line: #e3e6eb; --line2: #eef0f3;
  --accent: #4f6bed; --accent-ink: #fff; --warn: #c2410c; --warn-bg: #fff3e8; --bad: #c92a2a; --bad-bg: #ffecec;
  --ok: #2b8a3e; --ok-bg: #e9f7ee; --hover: #f7f8fa; --focus: #e8edff;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161b; --panel: #1c1f26; --ink: #e6e8ee; --muted: #9aa1ad; --line: #2c313b; --line2: #252932;
    --accent: #7088ff; --warn: #ffa94d; --warn-bg: #3a2a1a; --bad: #ff8787; --bad-bg: #3a1e1e;
    --ok: #69db7c; --ok-bg: #1b3324; --hover: #232731; --focus: #263056;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161b; --panel: #1c1f26; --ink: #e6e8ee; --muted: #9aa1ad; --line: #2c313b; --line2: #252932;
  --accent: #7088ff; --warn: #ffa94d; --warn-bg: #3a2a1a; --bad: #ff8787; --bad-bg: #3a1e1e;
  --ok: #69db7c; --ok-bg: #1b3324; --hover: #232731; --focus: #263056;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--panel); }
.demo-bar { background: var(--warn-bg); color: var(--warn); font-size: 13px; padding-block: 7px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.demo-bar button { border: 1px solid currentColor; background: none; color: inherit; border-radius: 6px; padding: 2px 9px; cursor: pointer; font-size: 12.5px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

/* Kopfzeile */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 18px; padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.logo { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); display: inline-block; }
nav { display: flex; gap: 2px; flex-wrap: wrap; }
nav button { border: 0; background: none; padding: 7px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 500; }
nav button:hover { background: var(--hover); color: var(--ink); }
nav button.on { background: var(--focus); color: var(--accent); }
.tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
#search { width: 280px; max-width: 50vw; padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.menu { position: relative; }
.pop { position: absolute; right: 0; top: 38px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 5px; display: flex; flex-direction: column; min-width: 160px; }
[hidden] { display: none !important; }
.pop a, .pop button { text-align: left; padding: 7px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-decoration: none; color: var(--ink); }
.pop a:hover, .pop button:hover { background: var(--hover); }

main { padding-block: 20px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); max-width: 1500px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 26px 0 10px; display: flex; align-items: center; gap: 10px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }

/* Buttons */
.btn { border: 1px solid var(--line); background: var(--panel); padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 500; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { padding: 3px 9px; font-size: 13px; }
.ghost { border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 5px 11px; cursor: pointer; }
.x { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 3px 7px; border-radius: 6px; }
.x:hover { color: var(--bad); background: var(--bad-bg); }
.x.armed { color: #fff; background: var(--bad); }

/* Karten */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 14px 16px; position: relative; overflow: hidden; }
.card.click { cursor: pointer; }
.card.click:hover { border-color: var(--accent); }
.card .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.card .t { font-weight: 600; margin-bottom: 2px; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 10px 0 0; font-size: 13px; }
.card dt { color: var(--muted); }
.card dd { margin: 0; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--line2); color: var(--muted); margin-right: 4px; white-space: nowrap; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 12px 16px; min-width: 150px; }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 13px; }

/* Blockleiste */
.bar { display: flex; height: 34px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--line2); }
.bar div { height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; border-right: 1px solid rgba(255,255,255,.35); cursor: default; }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 16px; margin-top: 10px; font-size: 13px; }
.legend div { display: flex; gap: 8px; align-items: center; }
.sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }

/* Tabellen */
.tablewrap { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; overflow: auto; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 8px 8px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; white-space: nowrap; }
td { border-bottom: 1px solid var(--line2); padding: 1px 2px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--hover); }
tr.flash td { background: var(--focus) !important; transition: background .2s; }
tr.empty td input, tr.empty td select { color: var(--muted); }
td input[type=text], td input:not([type]), td select, td input[type=number], td input[type=password] { width: 100%; border: 1px solid transparent; background: transparent; padding: 5px 6px; border-radius: 6px; min-width: 50px; }
td input:hover, td select:hover { border-color: var(--line); }
td input:focus, td select:focus { outline: none; border-color: var(--accent); background: var(--panel); }
td input.mono { font-family: var(--mono); font-size: 13px; }
td input[type=color] { width: 28px; height: 24px; border: 0; padding: 0; background: none; cursor: pointer; }
td input[type=checkbox] { margin: 0 8px; width: 16px; height: 16px; accent-color: var(--accent); }
td.c { text-align: center; }
td.info { padding: 0 8px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
td.saved input, td.saved select { background: var(--ok-bg); }
.rowbad td { background: var(--bad-bg); }
.addrow { display: flex; gap: 8px; padding: 8px; border-top: 1px solid var(--line2); }
.filter { padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); min-width: 240px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; flex-wrap: wrap; }

/* Netz-Auswahl */
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 6px 13px; cursor: pointer; display: flex; gap: 7px; align-items: center; font-weight: 500; }
.pill.on { border-color: var(--accent); background: var(--focus); }

/* IP-Raster */
.ipgrid-wrap { display: grid; grid-template-columns: minmax(0, 560px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .ipgrid-wrap { grid-template-columns: 1fr; } }
.ipgrid { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 10px; }
.ipc { aspect-ratio: 1; border-radius: 4px; font-size: 10px; font-family: var(--mono); display: flex; align-items: center; justify-content: center; cursor: pointer; background: var(--line2); color: var(--muted); position: relative; user-select: none; }
.ipc:hover { outline: 2px solid var(--accent); z-index: 2; }
.ipc.used { color: #fff; font-weight: 700; }
.ipc.used::after { content: ""; position: absolute; right: 2px; top: 2px; width: 4px; height: 4px; border-radius: 50%; background: #fff; }
.ipc.dup { outline: 2px solid var(--bad); }
.ipc.na { opacity: .35; cursor: default; }
.netform { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 14px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 14px; }
.netform label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); font-weight: 600; }
.netform input, .netform select, .netform textarea { border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; background: var(--bg); color: var(--ink); font-weight: 400; font-size: 14px; }
.netform .wide { grid-column: 1 / -1; }
.netform .chk { flex-direction: row; align-items: center; gap: 7px; }
.tip { position: fixed; z-index: 50; background: var(--ink); color: var(--panel); padding: 6px 9px; border-radius: 7px; font-size: 12.5px; pointer-events: none; max-width: 280px; }

/* Patchfeld */
.locs { display: grid; grid-template-columns: 250px 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .locs { grid-template-columns: 1fr; } }
.loclist { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 6px; position: sticky; top: 70px; }
.loclist button.l { display: flex; justify-content: space-between; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.loclist button.l:hover { background: var(--hover); }
.loclist button.l.on { background: var(--focus); color: var(--accent); font-weight: 600; }
.loclist .cnt { color: var(--muted); font-size: 12px; font-weight: 400; }
.panelbox { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; margin-bottom: 18px; overflow: hidden; }
.panelhead { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line2); flex-wrap: wrap; }
.panelhead input { border: 1px solid transparent; background: transparent; padding: 4px 6px; border-radius: 6px; font-weight: 600; font-size: 15px; }
.panelhead input:hover { border-color: var(--line); }
.panelhead input.n { width: 60px; font-weight: 400; font-size: 13px; }
.rack { background: #23262d; padding: 12px 14px; display: grid; gap: 6px 4px; }
.jack { background: #3a3f49; border-radius: 4px; height: 34px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #aeb4bf; font-size: 10px; font-family: var(--mono); cursor: pointer; border-bottom: 3px solid transparent; }
.jack:hover { outline: 2px solid #8da2ff; }
.jack .hole { width: 14px; height: 9px; background: #15171b; border-radius: 2px; margin-bottom: 2px; }
.jack.used { color: #fff; }
.locedit { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.locedit input { border: 1px solid transparent; background: transparent; font-size: 20px; font-weight: 700; padding: 2px 6px; border-radius: 7px; min-width: 360px; }
.locedit input:hover, .panelhead input:focus, .locedit input:focus { border-color: var(--line); outline: none; }
.locedit input.note { font-size: 14px; font-weight: 400; color: var(--muted); min-width: 360px; }

/* Blöcke */
h3.nethead { font-size: 13.5px; margin: 18px 0 8px; display: flex; gap: 8px; align-items: center; }
.blockcards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }
.bcard { padding: 0; }
.bhead { display: flex; gap: 8px; align-items: center; padding: 10px 12px 8px 16px; cursor: pointer; border-bottom: 1px solid var(--line2); }
.bhead:hover { background: var(--hover); }
.bhead .range { color: var(--muted); font-size: 12px; }
.bhead .tag { margin-left: auto; }
.bnote { font-size: 12px; color: var(--muted); padding: 6px 12px 0 16px; }
.blist { list-style: none; margin: 0; padding: 4px 0 6px; }
.blist li { display: grid; grid-template-columns: 42px 1fr auto; gap: 8px; padding: 3px 12px 3px 16px; font-size: 13px; cursor: pointer; }
.blist li:hover { background: var(--hover); }
.blist li .mono { color: var(--muted); font-size: 12px; }
.blist li .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.bempty { padding: 8px 16px 10px; font-size: 13px; }
.bsec { margin-bottom: 16px; scroll-margin-top: 70px; border-radius: 11px; }
.bsec.flash { box-shadow: 0 0 0 3px var(--accent); }
.bsechead { display: flex; gap: 10px; align-items: center; padding: 6px 2px 8px; flex-wrap: wrap; }
.bsechead .sw { width: 13px; height: 13px; }

/* Log */
.log td { padding: 7px 10px; font-size: 13px; vertical-align: top; }
.log .ch { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.log .ch del { color: var(--bad); }
.log .ch ins { color: var(--ok); text-decoration: none; }

.notice { background: var(--warn-bg); color: var(--warn); border-radius: 9px; padding: 10px 14px; margin: 0 0 14px; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.openlist { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; }
.openlist div { padding: 8px 14px; border-bottom: 1px solid var(--line2); display: flex; gap: 10px; cursor: pointer; }
.openlist div:last-child { border-bottom: 0; }
.openlist div:hover { background: var(--hover); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 9px 16px; border-radius: 9px; z-index: 60; font-size: 13.5px; }
.toast.err { background: var(--bad); color: #fff; }
.searchres h2 { margin-top: 18px; }

@media (max-width: 700px) {
  main { padding-block: 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  #search { width: 100%; max-width: none; }
  .tools { width: 100%; }
  .openlist div { flex-wrap: wrap; gap: 4px 10px; }
  .bar div { font-size: 0; }
}
@media print {
  .top, .tools, .toolbar, .addrow, .x, .loclist, .btn, .pills { display: none !important; }
  body, .tablewrap, .card, .panelbox { background: #fff !important; color: #000 !important; }
  main { padding: 0; max-width: none; }
  .locs, .ipgrid-wrap { grid-template-columns: 1fr; }
  td input, td select { border: 0 !important; }
  .panelbox, tr { break-inside: avoid; }
}

/* Anmeldung, Einstellungen, Rollen */
body.loggedout #tabs, body.loggedout .tools { display: none; }
.login { max-width: 360px; margin: 8vh auto 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.login input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg); font-size: 15px; color: var(--ink); }
.login .btn { padding: 9px; margin-top: 4px; }
.login .notice { margin: 0; }
.who { padding: 7px 10px 9px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line2); margin-bottom: 4px; }
body:not(.isadmin) .adminonly { display: none !important; }
.setsec { margin-bottom: 26px; }
.setsec h2 { margin-bottom: 2px; }
.setsec .sub { margin-bottom: 10px; }
.newuser { flex-wrap: wrap; }
.newuser input, .newuser select { border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; background: var(--bg); min-width: 0; flex: 1 1 140px; }
.fwsec .fwports { font-size: 11.5px; flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td input:disabled, td select:disabled { color: var(--ink); opacity: 1; -webkit-text-fill-color: var(--ink); }

/* Proxmox */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.dot.on { background: var(--ok); }
.dot.off { background: var(--bad); }
.bad-t { color: var(--bad); font-weight: 600; }
.meters { display: grid; gap: 5px; margin-top: 10px; }
.meter { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.mbar { height: 6px; background: var(--line2); border-radius: 3px; overflow: hidden; }
.mbar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------- Netzwerkplan ---------- */
:root {
  --m-bg: #edf2f8; --m-earth: #e6dccc; --m-earthln: #d9cbb3; --m-wall: #ffffff; --m-wallln: #2b3140; --m-floor: #fbfcfe; --m-cellar: #f2ede5;
  --m-roof: #e8ecf2; --m-roomtxt: #7a8394; --m-div: #c6cdd8; --m-riser: #e4e8ef; --m-glas: #f08c00; --m-kupfer: #2f6fed; --m-label: #1d2230; --m-chip: #2b3140; --m-chiptxt: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --m-bg: #11141a; --m-earth: #29231c; --m-earthln: #352d24; --m-wall: #1a1e26; --m-wallln: #8b93a3; --m-floor: #1d222b; --m-cellar: #221f1b;
    --m-roof: #232833; --m-roomtxt: #7f8899; --m-div: #3a414d; --m-riser: #262c36; --m-glas: #ffaa22; --m-kupfer: #5b8cff; --m-label: #e6e8ee; --m-chip: #e6e8ee; --m-chiptxt: #14161b;
  }
}
:root[data-theme="dark"] {
  --m-bg: #11141a; --m-earth: #29231c; --m-earthln: #352d24; --m-wall: #1a1e26; --m-wallln: #8b93a3; --m-floor: #1d222b; --m-cellar: #221f1b;
  --m-roof: #232833; --m-roomtxt: #7f8899; --m-div: #3a414d; --m-riser: #262c36; --m-glas: #ffaa22; --m-kupfer: #5b8cff; --m-label: #e6e8ee; --m-chip: #e6e8ee; --m-chiptxt: #14161b;
}
.maphead { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.maphead h1 { margin: 0; }
.maptools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; }
.crumb { border: 0; background: none; padding: 5px 9px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; }
.crumb:hover { background: var(--hover); color: var(--ink); }
.crumb.on { color: var(--ink); }
.crumbs .sep { color: var(--muted); }
.mchips { display: flex; gap: 5px; flex-wrap: wrap; }
.mchip { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 4px 11px; font-size: 13px; cursor: pointer; }
.mchip:hover { border-color: var(--accent); }
.mchip.on { background: var(--focus); border-color: var(--accent); color: var(--accent); }
.mright { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mtog { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 4px 11px; font-size: 13px; cursor: pointer; opacity: .55; }
.mtog.on { opacity: 1; }
.mtog i, .lg { display: inline-block; width: 18px; height: 4px; border-radius: 2px; flex: none; }
.mtog.glas i, .lg.glas { background: var(--m-glas); box-shadow: 0 0 6px var(--m-glas); }
.mtog.kupfer i, .lg.kupfer { background: var(--m-kupfer); }
.lg.dotc { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, #4f6bed, #f08c00 50%, #2f9e44); }
.mapstage { position: relative; height: calc(100vh - 190px); min-height: 520px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--m-bg); }
.mapsvg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; background: var(--m-bg); cursor: grab; }
.mapsvg:active { cursor: grabbing; }
.earthbg { fill: var(--m-earth); } .earthln { stroke: var(--m-earthln); stroke-width: 6; }
.ground { stroke: var(--m-wallln); stroke-width: 3; }
.wall { fill: var(--m-wall); stroke: var(--m-wallln); stroke-width: 4; }
.fl.lv { fill: var(--m-floor); stroke: var(--m-wallln); stroke-width: 2; }
.fl.cellar { fill: var(--m-cellar); stroke: var(--m-wallln); stroke-width: 2; }
.roof, .roofdeco { fill: var(--m-roof); stroke: var(--m-wallln); stroke-width: 4; stroke-linejoin: round; }
.deco { fill: none; stroke: var(--m-div); stroke-width: 2.5; } .decoln { stroke: var(--m-div); stroke-width: 1.5; }
.divider { stroke: var(--m-div); stroke-width: 2.5; stroke-dasharray: 8 6; }
.divhit { fill: transparent; cursor: col-resize; }
.editing .divhit:hover { fill: var(--accent); opacity: .2; }
.roomlbl { fill: var(--m-roomtxt); font: 600 15px system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; pointer-events: none; }
.flabel { cursor: pointer; } .flabel rect { fill: var(--m-chip); } .flabel text { fill: var(--m-chiptxt); font: 700 15px system-ui, sans-serif; }
.flabel:hover rect { fill: var(--accent); }
.floor.focus .fl, .floor.focus .roof { stroke: var(--accent); stroke-width: 5; }
.riser { fill: var(--m-riser); stroke: var(--m-div); stroke-width: 1.5; stroke-dasharray: 4 4; }
.conduit { stroke: var(--m-div); stroke-width: 12; stroke-linecap: round; opacity: .7; }
.hname { fill: var(--m-label); font: 700 50px system-ui, sans-serif; pointer-events: none; }
.hsub { fill: var(--m-roomtxt); font: 600 38px system-ui, sans-serif; pointer-events: none; }
.mapsvg:not(.mode-overview) .hsub { display: none; }
.mapsvg:not(.mode-overview) .hname { font-size: 34px; }
.househit { fill: transparent; cursor: zoom-in; }
.mapsvg:not(.mode-overview) .househit { display: none; }
.mode-overview .house:hover .wall, .mode-overview .house:hover .roofdeco, .mode-overview .house:hover .roof { stroke: var(--accent); }
.mode-overview .mnode, .mode-overview .mlink, .mode-overview .flabel { pointer-events: none; }
.mode-overview .nlbl, .mode-overview .nsub, .mode-overview .nab, .mode-overview .flabel { display: none; }
.mlink path { fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.mlink .under { stroke: var(--m-bg); stroke-width: 8; }
.mlink .core { stroke-width: 3.4; transition: stroke-width .15s; }
.mlink.glas .core { stroke: var(--m-glas); filter: url(#glow); }
.mlink.kupfer .core { stroke: var(--m-kupfer); }
.mlink .flow { stroke: #fff; stroke-width: 1.8; stroke-dasharray: 2 14; opacity: 0; }
.mlink.hot .flow, .mlink.hov .flow { opacity: .95; animation: mflow .9s linear infinite; }
.mlink.hot .core, .mlink.hov .core, .mlink:hover .core { stroke-width: 5; }
.mlink.dim { opacity: .16; }
.mlink .hit { stroke: transparent; stroke-width: 18; pointer-events: stroke; cursor: pointer; }
@keyframes mflow { to { stroke-dashoffset: -16; } }
@media (prefers-reduced-motion: reduce) { .mlink.hot .flow, .mlink.hov .flow { animation: none; } }
.mnode { cursor: pointer; }
.mnode .nb { stroke: var(--m-bg); stroke-width: 3; transition: stroke .15s; }
.mnode:hover .nb { stroke: var(--accent); }
.mnode .nab { fill: #fff; font: 700 10.5px var(--mono); pointer-events: none; }
.mnode .nlbl { fill: var(--m-label); font: 600 12.5px system-ui, sans-serif; paint-order: stroke; stroke: var(--m-bg); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.mnode .nsub { fill: var(--m-roomtxt); font: 10.5px var(--mono); paint-order: stroke; stroke: var(--m-bg); stroke-width: 3px; pointer-events: none; }
.mnode.dim { opacity: .28; }
.mnode.sel .nb { stroke: var(--accent); stroke-width: 5; }
.mnode.from .nb { stroke: var(--m-glas); stroke-width: 6; }
.mnode.dragging { opacity: .8; }
.editing .mnode { cursor: move; }
.mbanner { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 8px 10px 8px 14px; border-radius: 10px; display: flex; gap: 10px; align-items: center; font-size: 13.5px; z-index: 5; max-width: calc(100% - 24px); }
.mbanner .btn { background: transparent; color: inherit; border-color: currentColor; }
.mlegend { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; }
.mlegend span { display: inline-flex; align-items: center; gap: 6px; }
.mpanel { position: absolute; top: 12px; right: 12px; bottom: 12px; width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.14); overflow: auto; padding: 14px; z-index: 6; }
.mph { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.mph b { font-size: 15.5px; } .mph .muted { font-size: 12.5px; }
.mdl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 6px 0 4px; font-size: 13px; }
.mdl dt { color: var(--muted); } .mdl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mpsec { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.mplinks { display: flex; flex-direction: column; gap: 4px; }
.mpl { display: flex; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line2); background: var(--bg); border-radius: 8px; padding: 7px 9px; cursor: pointer; width: 100%; }
.mpl:hover { border-color: var(--accent); }
.mpl span { display: flex; flex-direction: column; min-width: 0; }
.mpl b { font-size: 13px; font-weight: 600; } .mpl small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.mpacts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.mpform { display: flex; flex-direction: column; gap: 9px; margin: 8px 0; }
.mpform label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.mpform input, .mpform select { border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; background: var(--bg); color: var(--ink); font-size: 14px; font-weight: 400; }
.mprow { display: grid; grid-template-columns: 1fr 100px; gap: 8px; }
.mproom { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-bottom: 5px; }
.mproom input { border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; background: var(--bg); color: var(--ink); min-width: 0; }
.mproom .mono { font-size: 12px; }
.seg { display: flex; gap: 4px; }
.segb { flex: 1; display: inline-flex; gap: 8px; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--bg); border-radius: 7px; padding: 7px; cursor: pointer; color: var(--ink); font-weight: 600; }
.segb.on { border-color: var(--accent); background: var(--focus); }

/* ---------- Handy (Desktop bleibt unverändert) ---------- */
@media (max-width: 700px) {
  .top { gap: 8px; }
  nav#tabs { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
  nav#tabs::-webkit-scrollbar { display: none; }
  nav#tabs button { flex: none; padding: 8px 11px; }
  .tools { order: 2; }
  h1 { font-size: 18px; }
  .stats .stat { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .stat b { font-size: 19px; }
  .tablewrap table { min-width: 760px; }
  .tablewrap.log table { min-width: 600px; }
  td input[type=text], td input:not([type]), td select, td input[type=number], td input[type=password] { padding: 8px 6px; font-size: 15px; }
  .filter, .toolbar select { min-width: 0; flex: 1 1 100%; }
  .netform { grid-template-columns: 1fr 1fr; padding: 12px; }
  .netform input, .netform select, .netform textarea { font-size: 15px; }
  .loclist { position: static; display: flex; overflow-x: auto; gap: 4px; padding: 6px; }
  .loclist button.l { flex: none; width: auto; gap: 8px; }
  .loclist > div { flex: none; }
  .locedit input, .locedit input.note { min-width: 0; width: 100%; font-size: 17px; }
  .panelhead input.n[style] { width: 100% !important; }
  .rack { gap: 4px 3px; padding: 10px; overflow-x: auto; }
  .jack { height: 30px; min-width: 22px; }
  .bsechead { gap: 6px 8px; }
  .bsechead .btn { margin-left: 0 !important; }
  .fwsec .fwports { flex-basis: 100%; white-space: normal; }
  .blockcards { grid-template-columns: 1fr; }
  .mapstage { height: 68vh; min-height: 420px; }
  .maptools { gap: 8px; }
  .mright { margin-left: 0; width: 100%; }
  .mpanel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 60%; border-radius: 14px 14px 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .mlegend { bottom: auto; top: 10px; left: 10px; padding: 4px 8px; gap: 10px; font-size: 11px; }
  .mlegend span:last-child { display: none; }
  .mbanner { top: auto; bottom: 14px; }
  .mpl, .mchip, .crumb { padding-top: 9px; padding-bottom: 9px; }
}
.mode-building .mnode:not(.sel):not(.near):not(:hover) .nlbl, .mode-building .mnode:not(.sel):not(.near):not(:hover) .nsub { display: none; }
.mode-building .mnode.near .nsub { display: none; }
@media (max-width: 700px) {
  .netform > label, .netform > div { min-width: 0; }
  .netform input, .netform select, .netform textarea { width: 100%; min-width: 0; }
  .pills { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .pills::-webkit-scrollbar { display: none; }
  .pill { flex: none; }
}
@media (min-width: 701px) and (max-width: 1480px) {
  .top { gap: 12px; }
  #search { width: 190px; }
  nav button { padding: 7px 10px; }
}
@media (min-width: 701px) and (max-width: 1320px) {
  nav button { padding: 7px 7px; font-size: 13.5px; }
  #search { width: 150px; }
  .brand { font-size: 15px; }
}
.mnode .ru { fill: #6b7383; pointer-events: none; }
.mnode .led { fill: #40c057; pointer-events: none; }
.mnode.loc .nb { stroke-width: 3; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.mpnew { padding: 10px; border: 1px dashed var(--line); border-radius: 9px; margin-bottom: 10px; }
.mnode .nicon { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.icongrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 5px; }
.ico { height: 40px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); padding: 0; }
.ico:hover { border-color: var(--accent); }
.ico.on { border-color: var(--accent); background: var(--focus); color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ico .auto { font-size: 11px; font-weight: 700; }
.mpico { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.bico { display: inline-flex; align-items: center; color: var(--muted); }
.blist li { grid-template-columns: 18px 38px 1fr auto; }
.mhint { border: 1px solid var(--warn); color: var(--warn); background: var(--warn-bg); border-radius: 99px; padding: 4px 11px; font-size: 13px; font-weight: 600; cursor: pointer; }
.mpl.drag { cursor: grab; }
.rackico { background: #3a404c; color: #fff; }
.mghost { position: fixed; z-index: 100; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; pointer-events: none; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.planinfo { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: -4px 0 16px; font-size: 13.5px; }
.roomlbl { paint-order: stroke; stroke: var(--m-floor); stroke-width: 14px; stroke-linejoin: round; }
.mnode .nlbl, .mnode .nsub { stroke: var(--m-floor); }
.decoknob { fill: var(--m-div); }

/* Schrankansicht */
.rackwrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .rackwrap { grid-template-columns: 1fr; } }
.racksec { margin-bottom: 18px; }
.rackview { position: relative; background: #1f2229; border-radius: 10px; border: 8px solid #2c3039; box-shadow: inset 0 0 0 1px #0d0f13; }
.rackview .ru-row { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(255,255,255,.06); }
.rackview .ru-row span { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); font: 10px var(--mono); color: #6b7383; }
.rackview .ru-item { position: absolute; left: 24px; right: 8px; border-radius: 3px; background: #343944; border-left: 5px solid var(--c); display: flex; align-items: center; gap: 8px; padding: 0 8px; color: #e8eaef; overflow: hidden; box-shadow: inset 0 1px 0 rgba(255,255,255,.07); }
.rackview .ru-item.auto { outline: 1px dashed rgba(255,255,255,.35); outline-offset: -2px; }
.rackview .ru-item b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rackview .ru-item small { margin-left: auto; font: 11px var(--mono); color: #9aa1ad; white-space: nowrap; }
.rackview .ru-item:hover { filter: brightness(1.15); }
.rackview .ru-ico { display: inline-flex; color: var(--c); flex: none; }
.rackview .ru-ports { display: flex; gap: 2px; flex: none; }
.rackview .ru-ports i { width: 5px; height: 5px; background: #15171b; border-radius: 1px; }
.rackview.compact { border-width: 5px; }
.rackview.compact .ru-item { left: 6px; right: 6px; padding: 0 6px; gap: 6px; }
.rackview.compact .ru-item b { font-size: 11px; }
.rackview.compact .ru-ports i { width: 3px; height: 3px; }
.mnode .rbadge circle { fill: var(--accent); stroke: var(--m-bg); stroke-width: 2.5; }
.mnode .rbadge text { fill: #fff; font: 700 11px system-ui, sans-serif; pointer-events: none; }
/* WLAN */
:root { --m-wlan: #12b886; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --m-wlan: #38d9a9; } }
:root[data-theme="dark"] { --m-wlan: #38d9a9; }
.mtog.wlan i, .lg.wlan { background: repeating-linear-gradient(90deg, var(--m-wlan) 0 4px, transparent 4px 7px); }
.mlink.wlan .core { stroke: var(--m-wlan); stroke-dasharray: 2 7; stroke-width: 3.2; }
.mlink.wlan .under { stroke-width: 0; }
