/* Isolated Tree/Graph prototype. Loaded only by Labby-tree-graph-mockup. */
.prototype-badge {
  display: inline-flex;
  margin-left: .55rem;
  padding: .2rem .48rem;
  border: 1px solid color-mix(in srgb, var(--yellow) 65%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--yellow) 26%, var(--panel));
  color: var(--text);
  font: 800 .56rem/1 'Space Mono', monospace;
  letter-spacing: .08em;
  vertical-align: middle;
}

.prototype-dialog-title { display: grid; gap: .12rem; }
.prototype-dialog-title > span { font: 900 1rem/1.15 'Space Mono', monospace; }
.prototype-dialog-title > small { color: var(--muted); font: 600 .68rem/1.2 Inter, sans-serif; }

#tree-dialog.tree-dialog[open] {
  width: min(1500px, calc(100vw - 48px)) !important;
  max-width: min(1500px, calc(100vw - 48px)) !important;
  height: min(900px, calc(100dvh - 48px)) !important;
  max-height: min(900px, calc(100dvh - 48px)) !important;
  padding: .85rem !important;
  background: color-mix(in srgb, var(--bg) 78%, var(--phone));
}

#tree-dialog .tree-head { padding: .1rem .15rem .75rem; }
#tree-dialog .tree-content { padding: 0 !important; background: transparent !important; }
#tree-dialog .tree-shell { min-height: 100%; }
#tree-dialog .dialog-footer { padding-top: .65rem; }

.proto-view {
  --proto-line: color-mix(in srgb, var(--line) 30%, transparent);
  min-height: 100%;
  color: var(--text);
}

.proto-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: .65rem;
  align-items: center;
  padding: .72rem;
  border: 1px solid var(--proto-line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--phone) 94%, transparent);
  box-shadow: 0 8px 22px rgba(20, 31, 48, .07);
  position: sticky;
  top: 0;
  z-index: 8;
}

.proto-search { position: relative; }
.proto-search::before {
  content: '⌕';
  position: absolute;
  left: .78rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1rem;
  pointer-events: none;
}
.proto-search input { min-height: 40px; padding-left: 2.15rem; background: var(--panel); }
.proto-toolbar-actions, .proto-view-key { display: flex; align-items: center; gap: .42rem; flex-wrap: wrap; }
.proto-mini-btn {
  min-height: 38px;
  padding: .4rem .65rem;
  border: 1px solid var(--proto-line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: 750 .66rem/1 'Space Mono', monospace;
  cursor: pointer;
}
.proto-mini-btn:hover { border-color: var(--line); background: color-mix(in srgb, var(--yellow) 18%, var(--panel)); }
.proto-key { display: inline-flex; gap: .3rem; align-items: center; color: var(--muted); font: 650 .62rem/1.2 Inter, sans-serif; }
.proto-key::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--key-color, var(--line)); }
.proto-key.hardware { --key-color: var(--type-hardware); }
.proto-key.workload { --key-color: var(--type-vm); }
.proto-key.app { --key-color: var(--type-app); }
.proto-key.network { --key-color: var(--type-network); }

.proto-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: .55rem;
  margin: .7rem 0;
}
.proto-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .55rem;
  padding: .68rem .78rem;
  border: 1px solid var(--proto-line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}
.proto-stat strong { font: 900 1.05rem/1 'Space Mono', monospace; }
.proto-stat span { color: var(--muted); font: 700 .62rem/1.2 Inter, sans-serif; text-transform: uppercase; letter-spacing: .05em; }

.proto-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: .7rem; min-height: 520px; }
.proto-main, .proto-inspector {
  border: 1px solid var(--proto-line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--phone) 95%, transparent);
  box-shadow: 0 8px 24px rgba(20, 31, 48, .06);
}
.proto-main { min-width: 0; padding: .75rem; overflow: auto; }
.proto-inspector { padding: .85rem; min-width: 0; }
.proto-inspector-sticky { position: sticky; top: 4.8rem; display: grid; gap: .75rem; }
.proto-inspector-empty { min-height: 260px; display: grid; place-content: center; text-align: center; gap: .5rem; color: var(--muted); }
.proto-inspector-empty .proto-empty-icon { font-size: 1.8rem; }
.proto-inspector-empty strong { color: var(--text); font: 850 .78rem/1.2 'Space Mono', monospace; }
.proto-inspector h4 { margin: 0; font-size: .9rem; }
.proto-inspector-type { color: var(--muted); font: 700 .65rem/1.2 Inter, sans-serif; }
.proto-inspector-grid { display: grid; gap: .45rem; }
.proto-info-row { display: grid; grid-template-columns: 80px 1fr; gap: .5rem; padding-top: .45rem; border-top: 1px solid var(--proto-line); font: 650 .66rem/1.35 Inter, sans-serif; }
.proto-info-row span:first-child { color: var(--muted); }
.proto-relations { display: flex; flex-wrap: wrap; gap: .35rem; }
.proto-relation-pill { padding: .28rem .45rem; border: 1px solid var(--proto-line); border-radius: 999px; background: var(--panel); font: 650 .58rem/1.15 Inter, sans-serif; }

.proto-group { margin-bottom: .75rem; border: 1px solid var(--proto-line); border-radius: 13px; overflow: clip; background: color-mix(in srgb, var(--panel) 68%, transparent); }
.proto-group:last-child { margin-bottom: 0; }
.proto-group-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem .8rem; background: color-mix(in srgb, var(--phone) 80%, var(--panel)); }
.proto-group-title { display: grid; gap: .15rem; }
.proto-group-title strong { font: 850 .75rem/1.2 'Space Mono', monospace; }
.proto-group-title small { color: var(--muted); font: 600 .62rem/1.25 Inter, sans-serif; }
.proto-count { min-width: 26px; padding: .2rem .42rem; border-radius: 999px; background: var(--panel); border: 1px solid var(--proto-line); text-align: center; font: 800 .62rem/1 'Space Mono', monospace; }
.proto-tree-roots { display: grid; gap: .45rem; padding: .6rem; }
.proto-tree-node { border: 1px solid var(--proto-line); border-radius: 11px; background: var(--phone); overflow: clip; }
.proto-tree-node[open] { border-color: color-mix(in srgb, var(--line) 54%, transparent); }
.proto-node-summary { list-style: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .62rem; align-items: center; padding: .58rem .65rem; cursor: pointer; }
.proto-node-summary::-webkit-details-marker { display: none; }
.proto-node-summary:hover { background: color-mix(in srgb, var(--mint) 14%, transparent); }
.proto-node-symbol { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--proto-line); border-radius: 9px; background: var(--node-bg, var(--panel)); font-size: .92rem; }
.proto-node-copy { min-width: 0; display: grid; gap: .12rem; }
.proto-node-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 800 .7rem/1.2 'Space Mono', monospace; }
.proto-node-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font: 620 .6rem/1.2 Inter, sans-serif; }
.proto-node-meta { display: flex; align-items: center; justify-content: flex-end; gap: .38rem; }
.proto-status { width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; box-shadow: 0 0 0 3px color-mix(in srgb, #98a2b3 16%, transparent); }
.proto-status.online, .proto-status.live { background: #2eb67d; box-shadow: 0 0 0 3px color-mix(in srgb, #2eb67d 18%, transparent); }
.proto-status.offline { background: #e35757; box-shadow: 0 0 0 3px color-mix(in srgb, #e35757 18%, transparent); }
.proto-status.maintenance { background: #e5a634; box-shadow: 0 0 0 3px color-mix(in srgb, #e5a634 18%, transparent); }
.proto-child-count { color: var(--muted); font: 750 .58rem/1 'Space Mono', monospace; }
.proto-tree-children { display: grid; gap: .42rem; margin: 0 .55rem .55rem 1.55rem; padding: .48rem 0 0 .72rem; border-left: 2px solid color-mix(in srgb, var(--line) 22%, transparent); }
.proto-node-leaf .proto-node-summary { grid-template-columns: auto minmax(0, 1fr) auto; }
.proto-node-selected { border-color: color-mix(in srgb, var(--yellow) 76%, var(--line)) !important; box-shadow: 0 0 0 2px color-mix(in srgb, var(--yellow) 18%, transparent); }
.proto-empty { padding: 1.2rem; text-align: center; color: var(--muted); font: 650 .68rem/1.4 Inter, sans-serif; }

.proto-graph-main { padding: 0; overflow: hidden; }
.proto-graph-scroll { position: relative; overflow: auto; min-height: 520px; height: 100%; background-image: radial-gradient(color-mix(in srgb, var(--line) 15%, transparent) 1px, transparent 1px); background-size: 20px 20px; }
.proto-graph-board { position: relative; min-width: 1120px; min-height: 610px; padding: .75rem; }
.proto-graph-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 1; }
.proto-edge { fill: none; stroke: color-mix(in srgb, var(--line) 52%, transparent); stroke-width: 2; }
.proto-edge.hosting { stroke: color-mix(in srgb, #617ee8 70%, var(--line)); }
.proto-edge.explicit { stroke: color-mix(in srgb, #2aa986 62%, var(--line)); stroke-dasharray: 5 5; }
.proto-edge.is-muted { opacity: .12; }
.proto-graph-lanes { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: .7rem; align-items: start; }
.proto-lane { min-height: 570px; padding: .55rem; border: 1px solid var(--proto-line); border-radius: 13px; background: color-mix(in srgb, var(--phone) 88%, transparent); }
.proto-lane-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; margin-bottom: .55rem; padding: .55rem .6rem; border: 1px solid var(--proto-line); border-radius: 10px; background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(8px); }
.proto-lane-head strong { font: 850 .68rem/1.15 'Space Mono', monospace; }
.proto-lane-head span { color: var(--muted); font: 750 .58rem/1 'Space Mono', monospace; }
.proto-lane-nodes { display: grid; gap: .55rem; }
.proto-graph-node { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .55rem; align-items: center; padding: .58rem; border: 1px solid var(--proto-line); border-radius: 11px; background: var(--phone); color: var(--text); text-align: left; cursor: pointer; box-shadow: 0 4px 12px rgba(20,31,48,.05); }
.proto-graph-node:hover { transform: translateY(-1px); border-color: var(--line); box-shadow: 0 8px 18px rgba(20,31,48,.09); }
.proto-graph-node.is-active { border-color: color-mix(in srgb, var(--yellow) 80%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 17%, transparent); }
.proto-graph-node.is-muted { opacity: .24; filter: grayscale(.45); }
.proto-node-kind { padding: .22rem .38rem; border-radius: 999px; background: var(--panel); color: var(--muted); font: 750 .52rem/1 'Space Mono', monospace; text-transform: uppercase; }
.proto-graph-legend { display: flex; gap: .7rem; align-items: center; color: var(--muted); font: 650 .58rem/1.2 Inter, sans-serif; }
.proto-graph-legend span { display: inline-flex; gap: .3rem; align-items: center; }
.proto-graph-legend i { width: 22px; height: 0; border-top: 2px solid #617ee8; }
.proto-graph-legend .explicit i { border-top-color: #2aa986; border-top-style: dashed; }

@media (max-width: 1100px) {
  #mobile-tree-mode-graph { display: inline-flex !important; }
  #tree-dialog.tree-dialog[open] { width: 100vw !important; max-width: 100vw !important; height: 100dvh !important; max-height: 100dvh !important; padding: .65rem !important; }
  .proto-toolbar { position: static; grid-template-columns: 1fr; }
  .proto-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proto-workspace { grid-template-columns: 1fr; }
  .proto-inspector { order: -1; }
  .proto-inspector-sticky { position: static; }
  .proto-inspector-empty { min-height: 100px; }
  .proto-main { min-height: 430px; }
  .prototype-badge { display: none; }
}
