.mech-panel-architecture {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.mech-arch-slot {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
.mech-arch {
  --arch-line: color-mix(in oklab, var(--border), var(--muted-foreground) 22%);
  --arch-faint: color-mix(in oklab, var(--muted-foreground) 65%, var(--card));
  position: relative;
  container: mech-arch / size;
  background: color-mix(in oklab, var(--muted) 55%, var(--card));
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.mech-arch [data-domain="power"] {
  --arch-domain: var(--domain-power);
}
.mech-arch [data-domain="signal"] {
  --arch-domain: var(--domain-signal);
}
.mech-arch [data-domain="data"] {
  --arch-domain: var(--domain-data);
}
.mech-arch [data-domain="mechanical"] {
  --arch-domain: var(--domain-mechanical);
}

.mech-arch-svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}
.mech-arch-svg:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}
.mech-arch-grid-dot {
  fill: color-mix(in oklab, var(--muted-foreground) 26%, transparent);
}
.mech-arch-svg text {
  font-family: inherit;
  fill: var(--foreground);
  pointer-events: none;
}
.mech-arch-svg .mech-arch-name {
  font-size: 13px;
  font-weight: 600;
}
.mech-arch-svg .mech-arch-subline,
.mech-arch-svg .mech-arch-port-label {
  font-size: 11px;
  fill: var(--muted-foreground);
}
.mech-arch-svg .mech-arch-port-spec,
.mech-arch-svg .mech-arch-pill text {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
}
.mech-arch-svg .mech-arch-port-spec {
  fill: var(--arch-faint);
}
.mech-arch-svg .mech-arch-glyph {
  font: 600 10px ui-monospace, SFMono-Regular, Menlo, monospace;
  fill: var(--primary-foreground);
}

.mech-arch-element,
.mech-arch-subsystem {
  outline: none;
  cursor: default;
  transition: opacity 0.12s;
}
.mech-arch-box {
  fill: var(--card);
  stroke: var(--arch-line);
  stroke-width: 1;
  filter: drop-shadow(0 1px 1.5px oklch(0.24 0.02 260 / 10%));
}
.mech-arch-head {
  fill: color-mix(in oklab, var(--muted) 45%, var(--card));
}
.mech-arch-element.optional .mech-arch-box {
  stroke-dasharray: 4 3;
}
.mech-arch-status {
  fill: var(--arch-line);
  opacity: 0.9;
}
.mech-arch-status[data-status="realized"] {
  fill: var(--mech-ok);
}
.mech-arch-status[data-status="broken"] {
  fill: var(--mech-err);
}
.mech-arch-status[data-status="unconfirmed"],
.mech-arch-status[data-status="specified"] {
  fill: var(--mech-warn);
}
.mech-arch-cad path {
  fill: none;
  stroke-width: 1.4;
  stroke-linejoin: round;
}
.mech-arch-cad.linked path {
  stroke: var(--mech-ok);
}
.mech-arch-cad.none path {
  stroke: var(--arch-faint);
  stroke-width: 1.3;
  stroke-dasharray: 2 2;
}
.mech-arch-cad.broken circle {
  fill: var(--mech-err-soft);
}
.mech-arch-svg .mech-arch-cad.broken text {
  font: 700 11px sans-serif;
  fill: var(--mech-err);
}
.mech-arch-cad.unconfirmed circle {
  fill: var(--mech-warn-soft);
}
.mech-arch-svg .mech-arch-cad.unconfirmed text {
  font: 700 11px sans-serif;
  fill: var(--mech-warn);
}
.mech-arch-err-dot {
  fill: var(--mech-err);
  pointer-events: none;
}
.mech-arch-element.sel .mech-arch-box {
  fill: color-mix(in oklab, var(--mech-accent) 5%, var(--card));
  stroke: var(--mech-accent);
  stroke-width: 2;
  stroke-dasharray: none;
}
.mech-arch-element.hov .mech-arch-box,
.mech-arch-element:focus-visible .mech-arch-box {
  stroke: var(--mech-accent);
  stroke-width: 1.5;
}
.mech-arch-element.linked .mech-arch-box,
.mech-arch-element.linking .mech-arch-box {
  stroke: var(--mech-accent);
  stroke-width: 1.5;
  stroke-dasharray: 5 3;
}
.mech-arch-element.drop .mech-arch-box {
  stroke: var(--mech-ok);
  stroke-width: 2;
}
.mech-arch-element.dim {
  opacity: 0.38;
}

.mech-arch-frame {
  stroke-width: 1.2;
}
/* Legacy subsystem frames carry their own fill and stroke attributes. */
.mech-arch-scope {
  fill: color-mix(in oklab, var(--muted) 35%, var(--card));
  stroke: var(--arch-line);
}
.mech-arch-frame.empty {
  stroke-dasharray: 6 5;
}
.mech-arch-subsystem.hov .mech-arch-frame,
.mech-arch-subsystem:focus-visible .mech-arch-frame {
  stroke-width: 2;
}
.mech-arch-subsystem.sel .mech-arch-frame {
  stroke: var(--mech-accent);
  stroke-opacity: 1;
  stroke-width: 2;
}
.mech-arch-subsystem.linked .mech-arch-frame {
  stroke: var(--mech-accent);
  stroke-opacity: 1;
  stroke-dasharray: 5 3;
}
.mech-arch-subsystem.drop .mech-arch-frame {
  stroke: var(--mech-ok);
  stroke-opacity: 1;
  stroke-width: 2.4;
  stroke-dasharray: 6 4;
}

.mech-arch-port {
  fill: var(--card);
  stroke: var(--arch-domain);
  stroke-width: 2;
  cursor: crosshair;
}
.mech-arch-port.on {
  fill: var(--arch-domain);
  stroke: var(--card);
}
.mech-arch-port:hover,
.mech-arch-port.hot {
  stroke: var(--foreground);
}
.mech-arch-port.ok {
  stroke: var(--mech-ok);
  stroke-width: 3;
}
.mech-arch-port.no {
  opacity: 0.25;
}

.mech-arch-wire {
  fill: none;
  stroke: var(--arch-domain);
  stroke-width: 2;
  transition: opacity 0.12s;
}
.mech-arch-wire.mech {
  stroke-dasharray: 6 4;
}
.mech-arch-wire.tentative {
  stroke-dasharray: 3 4;
  opacity: 0.55;
}
.mech-arch-wire.err {
  stroke: var(--mech-err);
}
.mech-arch-connection.hov .mech-arch-wire {
  stroke-width: 3;
  opacity: 1;
}
.mech-arch-connection.sel .mech-arch-wire {
  stroke-width: 3.4;
  opacity: 1;
}
.mech-arch-connection.dim .mech-arch-wire {
  opacity: 0.12;
}
.mech-arch-wire-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 12;
  pointer-events: stroke;
  cursor: pointer;
}
.mech-arch-pill {
  display: none;
  pointer-events: none;
}
.mech-arch-pill.show,
.mech-arch-near .mech-arch-pill {
  display: inline;
}
.mech-arch-far .mech-arch-subline,
.mech-arch-far .mech-arch-port-label,
.mech-arch-far .mech-arch-port-spec,
.mech-arch-far .mech-arch-cad {
  display: none;
}
.mech-arch-far .mech-arch-name {
  font-size: 18px;
}
.mech-arch-pill rect {
  fill: var(--card);
  stroke: var(--border);
}
.mech-arch-svg .mech-arch-pill text {
  font-weight: 500;
}
.mech-arch-host {
  fill: none;
  stroke: var(--domain-data);
  stroke-width: 1.4;
  stroke-dasharray: 2 4;
  opacity: 0.8;
}
.mech-arch-temp {
  display: none;
  fill: none;
  stroke: var(--mech-accent);
  stroke-width: 2;
  stroke-dasharray: 5 4;
  pointer-events: none;
}
.mech-arch-temp.on {
  display: inline;
}

.mech-arch-bar {
  position: absolute;
  z-index: 3;
  top: 0.5rem;
  left: 0.5rem;
  right: 12.5rem;
  pointer-events: none;
}
.mech-arch-bar > * {
  pointer-events: auto;
}
.mech-arch-views,
.mech-arch-tools {
  box-shadow: var(--shadow-xs);
}
.mech-arch-views {
  overflow-x: auto;
  scrollbar-width: none;
}
.mech-arch-tab {
  color: var(--muted-foreground);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 550;
  white-space: nowrap;
}
.mech-arch-tab:hover {
  color: var(--foreground);
  background: var(--muted);
}
.mech-arch-tab[aria-selected="true"] {
  color: var(--foreground);
  background: color-mix(in oklab, var(--mech-accent) 12%, var(--card));
}
.mech-arch-tab-edit {
  font: inherit;
  font-size: 0.72rem;
  outline: none;
}
.mech-arch-hidden {
  box-shadow: var(--shadow-xs);
}
.mech-arch-tools {
  position: absolute;
  z-index: 3;
  top: 0.5rem;
  right: 0.5rem;
}
.mech-arch-tools .mech-tool {
  gap: 0.3rem;
  min-height: 1.6rem;
  padding: 0.2rem 0.45rem;
  border-color: transparent;
  background: transparent;
  font-weight: 550;
}
.mech-arch-tools .mech-tool:hover {
  filter: none;
  background: var(--muted);
}

.mech-arch-zoom {
  position: absolute;
  z-index: 3;
  right: 0.5rem;
  bottom: 0.5rem;
}
.mech-arch-hint {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}
.mech-arch-hint[hidden] {
  display: none;
}
.mech-arch-hint-card {
  justify-items: center;
  pointer-events: auto;
}
.mech-arch-hint-card h3 {
  color: var(--foreground);
  font-size: 0.9rem;
  font-weight: 650;
}
.mech-arch-rename {
  position: absolute;
  z-index: 5;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  outline: none;
}

.mech-arch-menu {
  gap: 0;
  min-width: 13rem;
  max-width: 19rem;
  max-height: min(70vh, 30rem);
  padding: 0.3rem;
  overflow: auto;
}
.mech-arch-menu-item {
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
}
.mech-arch-menu-item:hover,
.mech-arch-menu-item:focus-visible {
  background: var(--muted);
  outline: none;
}
.mech-arch-menu-item.danger {
  color: var(--destructive);
}
.mech-arch-menu-item:disabled {
  opacity: 0.45;
  cursor: default;
}
.mech-arch-menu-hint {
  color: var(--muted-foreground);
  font: inherit;
  font-size: 0.68rem;
}
.mech-arch-kind {
  font: 600 0.6rem ui-monospace, SFMono-Regular, Menlo, monospace;
}

@container mech-arch (max-width: 680px) {
  .mech-arch-bar {
    right: 3rem;
  }
  .mech-arch-reader-controls {
    right: 3rem;
  }
  .mech-arch-tools {
    flex-direction: column;
  }
  .mech-arch-tools .mech-tool {
    width: 1.75rem;
    padding: 0;
  }
  .mech-arch-tool-text {
    display: none;
  }
}
@container mech-arch (max-width: 440px) {
  .mech-arch-sep {
    display: none;
  }
}
@container mech-arch (max-height: 260px) {
  .mech-arch-zoom {
    display: none;
  }
}
