:root {
  color-scheme: light;
  font:
    13px Inter,
    ui-sans-serif,
    system-ui,
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: inherit;
  padding: 9px 12px;
  cursor: pointer;
  transition:
    background 0.14s,
    border-color 0.14s;
}
button:hover {
  background: var(--hover);
  border-color: var(--accent-line);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #99b47b;
  outline-offset: 3px;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.primary:hover {
  background: var(--accent-hover);
}
.quiet,
.icon-button {
  background: transparent;
  border-color: transparent;
}
.icon-button {
  padding: 5px 9px;
  font-size: 17px;
}
.muted {
  color: var(--muted);
  line-height: 1.65;
  font-size: 12px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 1.9px;
  color: var(--muted);
  font-weight: 650;
}
#project-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 208px;
  padding: 24px 16px 18px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
}
.brand img {
  width: 25px;
  height: 30px;
}
.brand strong {
  font-size: 23px;
  letter-spacing: -1px;
}
.project-info {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 24px;
  min-width: 0;
}
#project-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex-shrink: 0;
  background: var(--hover);
  color: var(--accent);
  border-radius: 10px;
  font:
    23px Georgia,
    serif;
}
.project-info > div {
  min-width: 0;
}
h1 {
  font-size: 12px;
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#connection {
  font-size: 10px;
  color: var(--muted);
}
#new-agent {
  width: 100%;
  margin-bottom: 23px;
  font-size: 12px;
}
nav {
  display: grid;
  gap: 5px;
}
.nav-button {
  display: flex;
  gap: 11px;
  align-items: center;
  width: 100%;
  border-color: transparent;
  background: transparent;
  text-align: left;
  color: var(--muted);
  padding: 10px 9px;
  font-size: 12px;
}
.nav-button.current {
  background: var(--line);
  color: var(--ink);
}
.nav-button small {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
}
.side-heading {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1.8px;
  margin: 30px 9px 10px;
}
#agent-list {
  overflow-y: auto;
  min-height: 0;
}
.agent-link {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 9px;
  border-radius: 6px;
}
.agent-link.active {
  background: var(--line);
}
.agent-link strong {
  display: block;
  font-size: 11px;
  font-weight: 550;
}
.agent-link small {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: var(--muted);
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 20px;
}
.local-note {
  display: block;
  font-size: 9px;
  color: var(--muted);
  padding: 13px 9px 0;
}
#workspace {
  position: relative;
  margin-left: 208px;
  height: 100dvh;
  overflow: hidden;
}
.workspace-header {
  position: absolute;
  inset: 0 0 auto;
  height: 92px;
  padding: 23px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 2;
  background: var(--header);
  border-bottom: 1px solid var(--line);
}
.workspace-header h2 {
  margin: 7px 0 0;
  font:
    23px Georgia,
    serif;
  letter-spacing: -0.6px;
  font-weight: 400;
}
#sidebar-toggle {
  display: none;
}
#canvas {
  position: absolute;
  inset: 92px 0 0;
  overflow: clip;
  touch-action: none;
  background-image: radial-gradient(var(--line) 0.8px, transparent 0.8px);
  background-size: 22px 22px;
  outline: 0;
}
#canvas.panning {
  cursor: grabbing;
  user-select: none;
}
#graph {
  position: absolute;
  inset: 0 auto auto 0;
  transform-origin: 0 0;
}
#edges {
  position: absolute;
  overflow: visible;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.branch-edge {
  fill: none;
  stroke-width: 2;
  opacity: 0.65;
}
.team-edge {
  fill: none;
  stroke: #9e8bb2;
  stroke-width: 1.5;
  stroke-dasharray: 4 7;
  opacity: 0.7;
}
#root-node {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.root-dot {
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--paper);
}
#root-name {
  position: absolute;
  left: 0;
  top: 19px;
  font-size: 9px;
}
.agent-node {
  position: absolute;
  width: 430px;
  height: 306px;
  background: var(--terminal-bg);
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  box-shadow: 0 5px 22px #263c240b;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.agent-node.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #7e9c6324;
}
.agent-node.head-agent {
  border-color: var(--accent);
  box-shadow:
    0 0 0 2px #78946216,
    0 5px 22px #263c240b;
}
#open-head {
  font-size: 11px;
  white-space: nowrap;
}
.agent-node.teammate {
  border-color: #9a81aa;
  box-shadow: 0 0 0 3px #9a81aa25;
}
.node-header {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px 8px 14px;
  color: var(--ink);
  background: var(--surface);
  cursor: grab;
  background: var(--node-header);
  user-select: none;
}
.node-heading {
  min-width: 0;
  flex: 1;
}
.node-title {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}
.node-status {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-top: 3px;
}
.node-work {
  display: block;
  padding: 2px 0 0;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--accent);
  font-size: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-node.scope-overlap {
  border-color: #bd9a57;
}
#attention {
  font-size: 11px;
  margin-left: auto;
  background: #f2ecd9;
  color: #685327;
  border-color: #d7c9a2;
}
#attention-count {
  padding-left: 8px;
  font-weight: 650;
}
.scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}
.scope-list code {
  font-size: 10px;
  padding: 4px 6px;
  background: var(--hover);
  border-radius: 4px;
}
#graph-popover .work-warning {
  color: #9c7635;
  padding: 9px;
  background: #f6f0df;
  border-radius: 6px;
}
#graph-popover .work-ready {
  color: #527b47;
}
.work-files {
  display: grid;
  gap: 3px;
  max-height: 180px;
  overflow: auto;
  margin-bottom: 12px;
}
.work-files button {
  text-align: left;
  overflow-wrap: anywhere;
  font-size: 10px;
  background: transparent;
  border: 0;
  padding: 5px 0;
}
.popover-actions {
  display: flex;
  gap: 7px;
}
.popover-actions button {
  flex: 1;
  font-size: 11px;
}
#rename-form {
  display: flex;
  gap: 4px;
  align-items: center;
}
#rename-form input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  padding: 3px 6px;
  font-size: 12px;
}
.node-header .icon-button {
  font-size: 15px;
  padding: 4px 6px;
  color: var(--muted);
}
.dot {
  width: 6px;
  height: 6px;
  background: #adb9a0;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.live {
  background: #80a36c;
  box-shadow: 0 0 0 3px #8aaa7315;
}
.dot.busy {
  background: #c7a163;
}
.node-terminal {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 9px 6px 4px 9px;
  overflow: hidden;
  touch-action: auto;
}
.node-terminal .xterm {
  height: 100%;
}
.node-terminal .xterm-viewport {
  background-color: var(--terminal-bg);
  scrollbar-width: thin;
  scrollbar-color: var(--terminal-line) transparent;
}
.node-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  color: var(--terminal-muted);
  font-size: 11px;
  gap: 12px;
  text-align: center;
}
.node-placeholder button {
  padding: 7px 12px;
  background: #243221;
  border-color: var(--terminal-line);
  color: var(--terminal-fg);
  font-size: 11px;
}
.node-placeholder.read-only {
  background: var(--terminal-bg);
  z-index: 1;
}
.node-footer {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--terminal-muted);
  border-top: 1px solid var(--terminal-line);
  padding: 4px 9px;
  font-size: 9px;
}
.node-footer button {
  border: 0;
  background: transparent;
  color: var(--terminal-muted);
  padding: 2px 4px;
  font-size: 9px;
}
.node-footer .node-save {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.node-message {
  background: #343921;
  color: #d6d7ad;
  font-size: 11px;
  line-height: 1.5;
  padding: 8px 12px;
}
.agent-node.expanded {
  position: absolute;
  inset: 116px 24px 76px auto;
  width: min(980px, calc(100% - 56px));
  height: auto;
  z-index: 7;
  box-shadow: 0 16px 70px #243a2826;
  border-color: var(--accent);
}
#expanded-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}
#expanded-layer > * {
  pointer-events: auto;
}
.node-anchor {
  position: absolute;
  width: 430px;
  height: 306px;
  border: 1px dashed #b7c7a7;
  border-radius: 12px;
  background: #f4f7edaa;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}
#empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 25px;
  pointer-events: none;
}
#empty h3 {
  font:
    27px Georgia,
    serif;
  font-weight: 400;
  letter-spacing: -0.5px;
  margin: 0;
}
#empty p {
  margin: 13px 0 25px;
  color: var(--muted);
  font-size: 12px;
}
#empty button {
  pointer-events: auto;
  font-size: 12px;
}
.canvas-footer {
  position: absolute;
  inset: auto 20px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
#canvas-hint {
  font-size: 10px;
  color: var(--muted);
}
.camera-controls {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  box-shadow: 0 3px 10px #2f492605;
  pointer-events: auto;
}
.camera-controls button {
  background: transparent;
  border: 0;
  padding: 6px 9px;
  font-size: 10px;
}
#selection-bar {
  position: absolute;
  left: 50%;
  bottom: 66px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  padding: 7px 10px 7px 17px;
  border: 1px solid var(--accent-line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 8px 30px #2d432316;
  font-size: 11px;
  z-index: 4;
}
#graph-popover {
  position: absolute;
  width: min(330px, calc(100% - 20px));
  max-height: calc(100% - 20px);
  overflow-y: auto;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  box-shadow: 0 12px 40px #2b44201b;
  z-index: 8;
  touch-action: auto;
}
.popover-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px -4px 12px 0;
}
.popover-heading h3 {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  margin: 0;
}
#graph-popover p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 14px;
}
#graph-popover label {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
#graph-popover input,
#graph-popover textarea {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px;
  margin: 7px 0 12px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
}
#graph-popover textarea {
  min-height: 90px;
  resize: vertical;
}
#graph-popover form > button {
  width: 100%;
}
#graph-version-list {
  max-height: 290px;
  overflow-y: auto;
}
#drawer {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(390px, calc(100% - 24px));
  z-index: 10;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 35px #2b43200a;
  display: flex;
  flex-direction: column;
}
#drawer.wide {
  width: min(720px, calc(100% - 24px));
}
.drawer-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid var(--line);
  min-height: 68px;
  padding: 16px 15px 16px 22px;
}
.drawer-heading h2 {
  flex: 1;
  font-size: 14px;
  font-weight: 550;
  margin: 0;
}
#drawer-body {
  overflow-y: auto;
  padding: 23px;
  flex: 1;
  min-height: 0;
}
#drawer-body > :first-child {
  margin-top: 0;
}
#drawer label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin: 20px 0;
}
#drawer input:not([type="checkbox"]),
#drawer select,
#drawer textarea {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px;
  margin-top: 7px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
}
#drawer textarea {
  min-height: 90px;
  resize: vertical;
}
#drawer p {
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}
#drawer form > button {
  width: 100%;
  margin-top: 12px;
}
.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 18px 0;
}
.drawer-actions button {
  font-size: 11px;
}
.drawer-section {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 24px;
}
.drawer-section h3 {
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 14px;
}
.version-list {
  display: grid;
  gap: 9px;
}
.version-item {
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 12px;
  width: 100%;
}
.version-item img {
  width: 68px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 4px;
  object-fit: cover;
  object-position: top;
}
.version-item strong {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 550;
}
.version-item small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}
.version-image,
.version-video {
  display: block;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-bottom: 13px;
}
.gallery-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
}
.gallery-tabs button {
  font-size: 10px;
  white-space: nowrap;
  padding: 6px 9px;
}
.source-view {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--hover);
  padding: 15px;
  border-radius: 7px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--accent);
  max-height: 65dvh;
  overflow: auto;
}
.file-list {
  display: grid;
  gap: 5px;
}
.file-list button {
  border: 0;
  text-align: left;
  background: transparent;
  padding: 6px;
  font:
    11px ui-monospace,
    monospace;
  overflow-wrap: anywhere;
}
.change-file {
  margin: 12px 0;
  font-size: 11px;
  color: var(--accent);
}
.preview-frame {
  width: 100%;
  min-height: 430px;
  height: 58dvh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.recorded-steps {
  padding-left: 18px;
  font-size: 11px;
  color: var(--accent);
  line-height: 1.8;
}
.flow-result {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
#context-menu {
  position: fixed;
  min-width: 194px;
  max-width: calc(100% - 20px);
  z-index: 25;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 9px 35px #2b44201b;
}
#context-menu button {
  display: flex;
  width: 100%;
  background: transparent;
  border: 0;
  border-radius: 5px;
  text-align: left;
  padding: 9px 11px;
  font-size: 11px;
}
#context-menu button:hover,
#context-menu button:focus {
  background: var(--hover);
  outline: 0;
}
#context-menu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 5px;
}
#notice {
  position: fixed;
  bottom: 22px;
  left: calc(50% + 90px);
  transform: translateX(-50%);
  max-width: min(510px, calc(100% - 32px));
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: 9px;
  padding: 12px 17px;
  box-shadow: 0 8px 35px #2f472018;
  z-index: 30;
  font-size: 12px;
  line-height: 1.5;
}
[hidden] {
  display: none !important;
}
@media (max-width: 1050px) {
  #project-sidebar {
    width: 184px;
    padding: 22px 12px;
  }
  #workspace {
    margin-left: 184px;
  }
  .brand strong {
    font-size: 21px;
  }
  .workspace-header {
    padding: 22px;
  }
  #canvas-hint {
    display: none;
  }
  .canvas-footer {
    justify-content: flex-end;
  }
  .agent-node.expanded {
    inset: 110px 14px 72px 14px;
    width: auto;
  }
}
@media (max-width: 650px) {
  #project-sidebar {
    width: 190px;
    transform: translateX(-100%);
    transition: transform 0.18s;
  }
  body.sidebar-open #project-sidebar {
    transform: translateX(0);
    box-shadow: 0 0 40px #2b3f2426;
  }
  #workspace {
    margin-left: 0;
  }
  .workspace-header {
    height: 78px;
    padding: 17px 18px;
  }
  .workspace-header h2 {
    font-size: 20px;
  }
  .eyebrow {
    font-size: 7px;
    letter-spacing: 1.2px;
  }
  #canvas {
    top: 78px;
  }
  #sidebar-toggle {
    display: block;
  }
  .agent-node.expanded {
    inset: 93px 8px 67px;
    border-radius: 10px;
  }
  #drawer,
  #drawer.wide {
    width: calc(100% - 12px);
  }
  .camera-controls button {
    padding: 7px;
  }
  .canvas-footer {
    right: 10px;
    bottom: 14px;
  }
  #notice {
    left: 50%;
  }
  #empty h3 {
    font-size: 23px;
  }
  #empty p {
    font-size: 11px;
    text-align: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

.terminal-surface {
  position: absolute;
  top: 9px;
  left: 9px;
  transform-origin: top left;
}
