.ed-top { gap: 8px; padding-left: 10px; }
.ed-name {
  flex: 0 1 320px; min-width: 120px; height: 30px; padding: 0 8px; border: 0; border-radius: var(--r1); background: transparent;
  font-size: 15px; font-weight: 600; letter-spacing: -.01em; text-overflow: ellipsis;
}
.ed-name:hover:not(:disabled) { background: var(--mulde); }
.ed-name:focus { outline: 0; background: var(--feld-2); box-shadow: inset 0 0 0 1.5px var(--signal); }
.ed-status { display: inline-flex; align-items: center; gap: 6px; color: var(--tinte-3); font-size: 12px; white-space: nowrap; flex: 1; }
.ed-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c-gruen); }
.ed-status[data-s="dirty"]::before { background: var(--c-gelb); }
.ed-status[data-s="busy"]::before { background: var(--signal); animation: blink 1s infinite; }
.ed-status[data-s="ro"]::before { background: var(--tinte-4); }
@keyframes blink { 50% { opacity: .3; } }
.ed-div { width: 1px; height: 18px; margin: 0 4px; background: var(--kante-2); flex: none; }

.ed { flex: 1; min-height: 0; display: grid; grid-template-columns: 272px minmax(0, 1fr) 272px; }
.ed.no-lib { grid-template-columns: 0 minmax(0, 1fr) 272px; }
.ed.no-insp { grid-template-columns: 272px minmax(0, 1fr) 0; }
.ed.no-lib.no-insp { grid-template-columns: 0 minmax(0, 1fr) 0; }
.ed.ro { grid-template-columns: minmax(0, 1fr) 272px; }
.ed.ro.no-insp { grid-template-columns: minmax(0, 1fr) 0; }
.ed.no-lib .ed-lib, .ed.no-insp .ed-insp { display: none; }
.ed-lib, .ed-insp { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--feld); overflow: hidden; }
.ed-lib { border-right: 1px solid var(--kante); }
.ed-insp { border-left: 1px solid var(--kante); overflow-y: auto; scrollbar-width: thin; }

.ed-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--blech); }
.ed-svg { display: block; width: 100%; height: 100%; outline: 0; touch-action: none; user-select: none; -webkit-user-select: none; cursor: default; }
.ed-svg[data-tool="hand"], .ed-svg.grab { cursor: grab; }
.ed-svg.panning { cursor: grabbing; }
.ed-svg[data-tool="zone"], .ed-svg[data-tool="rect"], .ed-svg[data-tool="ellipse"], .ed-svg[data-tool="line"], .ed-svg[data-tool="note"] { cursor: crosshair; }
.ed-svg[data-tool="text"] { cursor: text; }
.ed-svg[data-tool="select"] [data-id] { cursor: move; }
.ed.ro .ed-svg [data-id] { cursor: pointer; }
.ed-svg text { pointer-events: none; }

.ed-over { pointer-events: none; }
.ed-over [data-h] { pointer-events: all; }
.ed-sel { fill: none; stroke: var(--signal); stroke-width: 1.5; }
.ed-sel.group { stroke-dasharray: 4 3; stroke-width: 1; }
.ed-sel.lock { stroke: var(--tinte-3); stroke-dasharray: 2 3; }
.ed-sel-line { fill: none; stroke: var(--signal); stroke-width: 4; stroke-opacity: .28; stroke-linecap: round; }
.ed-h { fill: var(--feld-2); stroke: var(--signal); stroke-width: 1.5; }
.ed-end { cursor: crosshair; }
.ed-conn { fill: var(--signal); fill-opacity: .25; stroke: var(--signal); stroke-width: 1.5; cursor: crosshair; transition: fill-opacity .12s; }
.ed-conn:hover { fill-opacity: 1; }
.ed-guide { stroke: #e5484d; stroke-width: 1; }
.ed-marq { fill: var(--signal-hauch); stroke: var(--signal); stroke-width: 1; }
.ed-target { fill: var(--signal-hauch); stroke: var(--signal); stroke-width: 2; }

.ed-tools {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px;
  border-radius: 10px; background: var(--feld-2); box-shadow: var(--schweb);
}
.ed-tool {
  display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--tinte-2);
  transition: background-color .1s, color .1s, transform .1s var(--aus);
}
.ed-tool:hover { background: var(--mulde); color: var(--tinte); }
.ed-tool:active { transform: scale(.94); }
.ed-tool.on { background: var(--signal); color: var(--signal-tinte); }
.ed-zoom { position: absolute; right: 12px; bottom: 16px; display: flex; align-items: center; padding: 3px; border-radius: 8px; background: var(--feld-2); box-shadow: var(--schweb); }
.ed-zoom-n { min-width: 52px; height: 26px; border: 0; border-radius: var(--r1); background: transparent; font: 12px var(--mono); font-variant-numeric: tabular-nums; color: var(--tinte-2); }
.ed-zoom-n:hover { background: var(--mulde); }
.ed-hint {
  position: absolute; left: 50%; bottom: 68px; transform: translateX(-50%); padding: 5px 10px; border-radius: 6px;
  background: var(--tinte); color: var(--blech); font-size: 12px; font-weight: 500; pointer-events: none; white-space: nowrap;
}
.ed-text {
  position: absolute; z-index: 3; margin: 0; padding: 0; border: 0; outline: 1.5px solid var(--signal); outline-offset: 2px; border-radius: 2px;
  background: transparent; color: var(--tinte); font-family: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.32; resize: none; overflow: hidden; white-space: pre-wrap;
}
.ed-text[data-t="zone"], .ed-text[data-t="line"], .ed-text[data-t="device"] { background: var(--feld-2); white-space: nowrap; padding: 0 6px; line-height: 1.7; }
.ed-text[data-t="text"] { letter-spacing: 0; }

.lib-tabs { padding: 10px 10px 8px; flex: none; }
.lib-tabs .seg { display: flex; }
.lib-tabs .seg button { flex: 1; justify-content: center; }
.lib-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; scrollbar-width: thin; }
.lib-filter { display: grid; gap: 6px; padding: 0 10px 8px; flex: none; position: sticky; top: 0; z-index: 1; background: var(--feld); }
.lib-res { padding: 0 6px 12px; }
.lib-acts { display: flex; gap: 6px; padding: 2px 4px 8px; }
.lib-acts .btn { flex: 1; justify-content: center; }
.lib-item {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 5px 6px; border-radius: var(--r1);
  cursor: grab; user-select: none;
}
.lib-item:hover { background: var(--mulde); }
.lib-item:active { cursor: grabbing; }
.lib-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--ch, var(--mulde-2)); color: var(--c, var(--tinte-2)); }
.lib-t { display: grid; min-width: 0; line-height: 1.3; }
.lib-t b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-t small { color: var(--tinte-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-t small .ip { font-size: 11px; }
.lib-item.placed .lib-t b { color: var(--tinte-3); }
.lib-item.placed .lib-ic { opacity: .55; }
.lib-none { padding: 14px 8px; color: var(--tinte-3); font-size: 12px; text-align: center; }
.lib-h { padding: 12px 12px 6px; }
.lib-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 10px 6px; }
.lib-tile {
  display: grid; justify-items: center; gap: 5px; padding: 10px 2px 8px; border: 0; border-radius: var(--r2); background: var(--feld-2);
  box-shadow: inset 0 0 0 1px var(--kante); color: var(--tinte-2); font-size: 11px; cursor: grab;
  transition: background-color .1s, box-shadow .1s, transform .1s var(--aus);
}
.lib-tile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.lib-tile:hover { box-shadow: inset 0 0 0 1px var(--kante-3); color: var(--tinte); }
.lib-tile:active { transform: scale(.97); }
.lib-tiles.sm { grid-template-columns: repeat(4, 1fr); padding-bottom: 16px; }
.lib-tiles.sm .lib-tile { font-size: 10px; padding: 8px 1px 6px; }
.lib-cables { display: grid; gap: 2px; padding: 0 6px 6px; }
.lib-cable { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 10px; height: 30px; padding: 0 6px; border: 0; border-radius: var(--r1); background: transparent; text-align: left; }
.lib-cable:hover { background: var(--mulde); }
.lib-cable-l { height: 0; border-top: var(--w, 2px) solid var(--c, var(--tinte)); }
.lib-cable-l.strich { border-top-style: dashed; }
.lib-cable-l.punkt { border-top-style: dotted; }

.in-sec { display: grid; gap: 8px; padding: 12px 12px 14px; border-bottom: 1px solid var(--kante); }
.in-h { margin-bottom: 2px; }
.in-row { display: grid; grid-template-columns: 62px minmax(0, 1fr); align-items: center; gap: 8px; }
.in-l { font-size: 12px; color: var(--tinte-3); }
.in-row .seg { display: flex; }
.in-row .seg button { flex: 1; justify-content: center; padding: 0 4px; font-size: 12px; }
.in-btns { display: flex; flex-wrap: wrap; gap: 4px; }
.in-p { font-size: 12px; line-height: 1.45; color: var(--tinte-2); text-wrap: pretty; }
.in-p.muted { color: var(--tinte-3); }
.in-p.warn { color: var(--warn); }
.in-check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; }
.in-check input { margin: 2px 0 0; accent-color: var(--signal); }
.in-keys { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; margin: 0; font-size: 11.5px; }
.in-keys dt { color: var(--tinte-2); font-weight: 500; white-space: nowrap; }
.in-keys dd { margin: 0; color: var(--tinte-3); }
.in-dev { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.in-dev .ip { font-size: 15px; }
.in-icons { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.in-icons button { display: grid; place-items: center; aspect-ratio: 1; border: 0; border-radius: var(--r1); background: transparent; color: var(--tinte-2); }
.in-icons button:hover { background: var(--mulde); }
.in-icons button.on { background: var(--signal-hauch); color: var(--signal); box-shadow: inset 0 0 0 1px var(--signal); }
.swatch[data-c="auto"] { --sw: conic-gradient(var(--c-blau), var(--c-lila), var(--c-orange), var(--c-gelb), var(--c-gruen), var(--c-blau)); background: var(--sw); }
.ed-insp .swatches { gap: 5px; }
.ed-insp .swatch { width: 19px; height: 19px; }

.ver { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 14px; height: min(52vh, 440px); }
.ver-list { display: grid; align-content: start; gap: 2px; overflow-y: auto; }
.ver-i { display: grid; gap: 1px; padding: 7px 8px; border: 0; border-radius: var(--r1); background: transparent; text-align: left; }
.ver-i:hover { background: var(--mulde); }
.ver-i.on { background: var(--signal-hauch); box-shadow: inset 0 0 0 1px var(--signal); }
.ver-i b { font-weight: 500; font-variant-numeric: tabular-nums; }
.ver-i small { color: var(--tinte-3); font-size: 11.5px; }
.ver-view { border-radius: var(--r2); background: var(--blech); box-shadow: inset 0 0 0 1px var(--kante); overflow: hidden; }
.ver-view svg { display: block; width: 100%; height: 100%; }

.print-host { display: none; }
@media print {
  @page { size: landscape; margin: 10mm; }
  body { overflow: visible; background: #fff; }
  body.printing > :not(.print-host) { display: none !important; }
  body.printing .print-host { display: block; }
  .print-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 4mm; font: 11pt system-ui, sans-serif; color: #000; }
  .print-head span { font-size: 9pt; color: #555; }
  .print-host svg { display: block; width: 100%; height: auto; max-height: 175mm; }
}

@media (max-width: 900px) {
  .ed, .ed.no-lib, .ed.no-insp, .ed.no-lib.no-insp, .ed.ro { grid-template-columns: minmax(0, 1fr); }
  .ed-lib, .ed-insp { position: absolute; z-index: 10; top: 52px; bottom: 0; width: min(288px, 86vw); box-shadow: var(--schweb); }
  .ed-lib { left: 0; } .ed-insp { right: 0; }
  .ed-status { display: none; }
  .ed-name { flex: 1; min-width: 60px; }
  .ed-top { padding: 8px 8px; gap: 4px; }
  .ed-top .hide-s, .ed-top .ed-div { display: none; }
  .ed-tools { bottom: 12px; max-width: calc(100% - 16px); }
  .ed-tool { width: 34px; height: 34px; }
  .ed-zoom { bottom: 64px; right: 8px; }
  .ed-hint { bottom: 108px; }
}
