.rack-frame {
  height: calc(var(--rack-units) * 22px);
  max-height: none;
}
.rack-device {
  padding: 2px 6px;
  font-size: .78rem;
  line-height: 1.15;
  background: #eef6ff;
  color: #132238;
}
.rack-device:hover {
  min-height: 2.8rem;
  overflow: visible;
  z-index: 3;
}
.rack-device:hover span { white-space: normal; }
.rack-frame {
  border-color: #718096;
  background-color: #fff;
  background-image: repeating-linear-gradient(to top, rgba(56, 73, 89, .16) 0, rgba(56, 73, 89, .16) 1px, transparent 1px, transparent calc(100% / var(--rack-units)));
}
.rack-device:hover { color: #132238; }
html[data-bs-theme="dark"] .rack-frame,
body[data-bs-theme="dark"] .rack-frame,
html[data-netbox-color-mode="dark"] .rack-frame {
  border-color: #3b4654;
  background-color: #212b36;
  background-image: repeating-linear-gradient(to top, rgba(200, 215, 230, .14) 0, rgba(200, 215, 230, .14) 1px, transparent 1px, transparent calc(100% / var(--rack-units)));
}
html[data-bs-theme="dark"] .rack-device,
body[data-bs-theme="dark"] .rack-device,
html[data-netbox-color-mode="dark"] .rack-device {
  background: #162e45;
  color: #fff;
}
.rack-topology {
  position: relative;
  min-height: 18rem;
  overflow: auto;
  padding: 1rem;
  background: var(--tblr-bg-surface-secondary, rgba(127, 127, 127, .05));
}
.rack-topology-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.rack-topology-columns {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  gap: 5rem;
  min-width: max-content;
  pointer-events: none;
}
.rack-topology-column {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  width: 15rem;
}
.rack-topology-column h4 { text-align: center; font-size: .85rem; }
.rack-topology-device-list { display: flex; flex-direction: column; gap: 20px; }
.rack-topology-node {
  display: block;
  padding: .55rem .75rem;
  border: 2px solid var(--node-color);
  border-radius: .35rem;
  background: var(--tblr-bg-surface, #fff);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
  cursor: grab;
  touch-action: none;
  user-select: none;
  pointer-events: auto;
}
.rack-topology-node.is-dragging { cursor: grabbing; z-index: 5; }
.rack-topology-node:hover { color: inherit; filter: brightness(.95); }
.rack-topology-node strong,
.rack-topology-node small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rack-topology-node small { opacity: .7; }
.rack-topology-edge {
  fill: none;
  stroke-width: 3;
  opacity: .8;
  pointer-events: stroke;
  cursor: pointer;
  transition: opacity .12s, stroke .12s, filter .12s, stroke-width .12s;
}
.rack-topology-edge.is-highlighted {
  stroke: var(--topology-highlight-color, #22c55e) !important;
  stroke-width: 5;
  opacity: 1;
  filter: drop-shadow(0 0 5px var(--topology-highlight-color, #22c55e));
}
.rack-topology-edge.is-dimmed { opacity: .12; }
.rack-topology-edge.is-wireless {
  stroke-dasharray: 7 7;
  stroke-linecap: round;
}
#rack-topology-card:fullscreen {
  margin: 0 !important;
  border: 0;
  border-radius: 0;
  background: var(--tblr-bg-surface, #fff);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#rack-topology-card:fullscreen .card-body { min-height: 0; flex: 1; overflow: hidden; }
#rack-topology-card:fullscreen .rack-topology { height: calc(100vh - 5.5rem); }
.rack-topology-tooltip {
  display: none;
  position: absolute;
  z-index: 10;
  width: max-content;
  max-width: 28rem;
  padding: .65rem .8rem;
  border: 1px solid var(--tblr-border-color, #ced4da);
  border-radius: .35rem;
  background: var(--tblr-bg-surface, #fff);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
  pointer-events: none;
}
.rack-topology-tooltip.is-visible { display: block; }
.rack-topology-tooltip > strong,
.rack-topology-tooltip > span,
.rack-topology-tooltip li span,
.rack-topology-tooltip li small { display: block; }
.rack-topology-tooltip ul { margin: .4rem 0 0; padding: 0; list-style: none; }
.rack-topology-tooltip li + li {
  margin-top: .45rem;
  padding-top: .45rem;
  border-top: 1px solid var(--tblr-border-color, #ced4da);
}
.rack-topology-tooltip small { opacity: .65; }
