.atlas-tree-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: auto;
  overflow-anchor: none;
  background-color: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, var(--diagram-grid) 0.9px, transparent 1.1px);
  background-size: 18px 18px;
  background-attachment: local;
  scrollbar-color: var(--control-line) var(--paper);
  scrollbar-width: thin;
  cursor: grab;
  touch-action: pan-x pan-y pinch-zoom;
}
.atlas-tree-viewport.is-panning { cursor: grabbing; user-select: none; }
.atlas-tree-viewport:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
.atlas-tree-frame { position: relative; min-width: 100%; min-height: 100%; overflow: hidden; }
.atlas-tree-drawing { position: absolute; top: 50%; left: 50%; transform-origin: center; }
.atlas-tree-links {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--diagram-edge);
  stroke-width: 1.55;
  stroke-linecap: round;
  pointer-events: none;
}
.atlas-tree-links .to-more { stroke-dasharray: .03 .055; }
.atlas-tree-links .is-on-path { stroke:var(--accent); stroke-width:3.25; }
.atlas-tree-card { position: absolute; transform-origin: left center; font-family: inherit; }
.atlas-tree-card .atlas-tree-node {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 70px;
  box-sizing: border-box;
  padding: 12px 15px;
  text-align: left;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--control-line);
  border-radius: 8px;
  appearance: none;
  cursor: pointer;
  font: inherit;
  line-height: 1.2;
}
.atlas-tree-section .atlas-tree-node { background: var(--diagram-section); }
.atlas-tree-card.atlas-tree-root .atlas-tree-node {
  min-height: 84px;
  background: var(--diagram-root);
  border-color: var(--diagram-root);
  color: var(--diagram-root-text);
}
.atlas-tree-card.is-selected .atlas-tree-node {
  border-color: var(--accent);
  box-shadow: inset 3px 0 var(--accent);
}
.atlas-tree-card.is-selected:not(.atlas-tree-root) .atlas-tree-node { background: var(--accent-soft); }
.atlas-tree-card.is-selected.atlas-tree-root .atlas-tree-node { box-shadow: inset 3px 0 var(--diagram-root-text), 0 0 0 2px var(--accent); }
.atlas-tree-card.is-on-path:not(.is-selected) .atlas-tree-node {
  border-color:var(--accent);
  box-shadow:inset 0 0 0 1px var(--accent);
}
.atlas-tree-node .atlas-tree-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 29px;
  height: 31px;
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-alt);
}
.atlas-tree-section .atlas-tree-icon { color: var(--ink); background: transparent; }
.atlas-tree-root .atlas-tree-icon { width: 34px; height: 36px; color: inherit; background: transparent; }
.atlas-tree-card.is-selected:not(.atlas-tree-root) .atlas-tree-icon { color: var(--accent); background: transparent; }
.atlas-tree-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.atlas-tree-root .atlas-tree-icon svg { width: 21px; height: 21px; }
.atlas-tree-copy { display: block; flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.atlas-tree-title {
  display: block;
  font-size: 14px;
  line-height: 1.22;
  font-weight: 650;
  letter-spacing: -.025em;
}
.atlas-tree-section .atlas-tree-title { font-size: 16px; }
.atlas-tree-root .atlas-tree-title { font-size: 19px; line-height: 1.15; }
.atlas-tree-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 5px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: .005em;
}
.atlas-tree-root .atlas-tree-meta { color: var(--diagram-root-text); font-size: 11px; }
.atlas-tree-status { display: inline-flex; align-items: center; gap: 4px; }
.atlas-tree-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.atlas-tree-status.is-draft::before { border: 1px solid var(--warning); border-radius: 0; background: transparent; transform: rotate(45deg); }
.atlas-tree-status + .atlas-tree-widgets::before { content: "·"; margin-right: 5px; }
.atlas-tree-card:not(.atlas-tree-root)::before {
  content: "";
  z-index: 1;
  position: absolute;
  top: 50%;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid var(--diagram-edge);
  background: var(--paper);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.atlas-tree-card .atlas-tree-toggle {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: 0;
  display: grid;
  place-items: center;
  transform: translate(50%, -50%);
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  padding: 0 0 1px;
  border: 1px solid var(--diagram-edge);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font: 600 17px/1 Arial, sans-serif;
  cursor: pointer;
}
.atlas-tree-card.is-on-path:not(.atlas-tree-root)::before {
  background:var(--accent);
  border-color:var(--accent);
}
.atlas-tree-root .atlas-tree-toggle { border-color: var(--diagram-root); }
.atlas-tree-card.atlas-tree-more .atlas-tree-node {
  min-height: 37px;
  padding: 7px 17px;
  justify-content: center;
  border-style: dashed;
  background: var(--paper);
  border-color: var(--diagram-edge);
  color: var(--muted);
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
}
@media (hover: hover) {
  .atlas-tree-card:not(.is-selected) .atlas-tree-node:hover { border-color: var(--ink); }
  .atlas-tree-card .atlas-tree-toggle:hover { background: var(--hover); border-color: var(--ink); }
  .atlas-tree-node:hover .atlas-tree-title { text-decoration: underline; text-underline-offset: 2px; }
}
.atlas-tree-card button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.atlas-tree-viewport.is-compact .atlas-tree-node { padding-inline: 10px; gap: 7px; }
.atlas-tree-viewport.is-compact .atlas-tree-icon { width: 23px; height: 26px; }
.atlas-tree-viewport.is-compact .atlas-tree-icon svg { width: 16px; height: 16px; }
.atlas-tree-viewport.is-compact .atlas-tree-root .atlas-tree-title { font-size: 16px; }
.atlas-tree-viewport.is-compact .atlas-tree-section .atlas-tree-title { font-size: 15px; }
@media (pointer: coarse) {
  .atlas-tree-card .atlas-tree-toggle { width: 29px; height: 29px; }
  .atlas-tree-card.atlas-tree-more .atlas-tree-node { min-height: 44px; }
}
@media (forced-colors: active) {
  .atlas-tree-viewport { scrollbar-color: auto; }
  .atlas-tree-links { stroke: CanvasText; }
  .atlas-tree-links .is-on-path { stroke:Highlight; }
  .atlas-tree-card.is-on-path:not(.is-selected) .atlas-tree-node { outline:2px solid Highlight; outline-offset:-2px; }
  .atlas-tree-card.is-selected .atlas-tree-node { border: 3px double Highlight; }
  .atlas-tree-status::before { border: 1px solid CanvasText; }
  .atlas-tree-card button:focus-visible { outline-color: Highlight; }
}
