:root {
  color-scheme: light;
  --bg: #fafafa;
  --bg-accent: #f5f5f5;
  --bg-elevated: #ffffff;
  --bg-hover: #f0f0f0;
  --card: #ffffff;
  --panel: #fafafa;
  --panel-strong: #f5f5f5;
  --text: #3f3f46;
  --text-strong: #18181b;
  --muted: #71717a;
  --muted-strong: #52525b;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --border-hover: #a1a1aa;
  --accent: #dc2626;
  --accent-subtle: rgba(220, 38, 38, 0.1);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
textarea,
select,
input {
  font: inherit;
}

button {
  color: inherit;
}

.vela-shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
  overflow: hidden;
  background: var(--bg);
}

.vela-titlebar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(250, 250, 250, 0.98);
}

.vela-title {
  color: #27272a;
  font-size: 15px;
  font-weight: 500;
}

.titlebar-menu {
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}

.titlebar-menu:hover {
  background: rgba(0, 0, 0, 0.05);
}

.titlebar-spacer {
  flex: 1;
}

.demo-identity {
  color: var(--muted);
  font-size: 11px;
}

.workspace {
  min-height: 0;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.workspace-center-pane {
  position: relative;
  flex: 1 1 0;
  min-width: 320px;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.workspace-resizer {
  position: relative;
  z-index: 24;
  width: 7px;
  min-width: 7px;
  height: 100%;
  display: grid;
  place-items: center;
  outline: none;
  background: #e3e5e8;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}

.workspace-resizer::before {
  content: "";
  position: absolute;
  inset: 0 -3px;
}

.workspace-resizer span {
  width: 2px;
  height: 44px;
  border-radius: 999px;
  background: #aeb4ba;
  opacity: 0.72;
  transition: height 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.workspace-resizer:hover span,
.workspace-resizer:focus-visible span,
body.is-resizing .workspace-resizer span {
  height: 72px;
  background: #6f767d;
  opacity: 1;
}

body.is-resizing,
body.is-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.canvas-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #fff;
}

#model-canvas {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  cursor: grab;
}

#model-canvas:active {
  cursor: grabbing;
}

.stage-actions {
  position: absolute;
  z-index: 7;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-toggle {
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 999px;
  color: #273449;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.stage-toggle:hover {
  border-color: rgba(59, 130, 246, 0.7);
}

.stage-toggle:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.stage-toggle[aria-pressed="true"] {
  color: #0f5fa8;
  border-color: rgba(37, 99, 235, 0.55);
  background: rgba(239, 246, 255, 0.96);
}

.stage-toggle--cad {
  min-width: 58px;
  letter-spacing: 0.05em;
}

.cad-view {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.98), rgba(240, 242, 241, 0.98)),
    #f3f4f3;
  touch-action: none;
}

.cad-view[hidden] {
  display: none;
}

.cad-sheet-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.cad-editor-svg {
  width: 100%;
  height: 100%;
  display: block;
  background: rgba(255, 255, 255, 0.92);
  cursor: grab;
  user-select: none;
}

.cad-editor-svg.is-panning {
  cursor: grabbing;
}

.cad-editor-svg.is-moving {
  cursor: move;
}

.cad-entity {
  cursor: move;
}

.cad-visible {
  fill: none;
  stroke: #263746;
  stroke-width: 1.05px;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.cad-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 10px;
  vector-effect: non-scaling-stroke;
  pointer-events: stroke;
}

.cad-entity text {
  fill: #263746;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  dominant-baseline: alphabetic;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.72);
  stroke-width: 0.8px;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
}

.cad-layer--dimension .cad-visible {
  stroke: #5f7890;
  stroke-width: 0.86px;
}

.cad-layer--hidden .cad-visible {
  stroke: #8ba0b2;
  stroke-width: 0.76px;
  stroke-dasharray: 5 4;
}

.cad-layer--center .cad-visible {
  stroke: #8a6d8b;
  stroke-width: 0.78px;
  stroke-dasharray: 10 3 2 3;
}

.cad-layer--annotation .cad-visible,
.cad-layer--annotation text {
  stroke: #3d5669;
  fill: #3d5669;
}

.cad-layer--fill .cad-visible {
  fill: rgba(164, 181, 192, 0.2);
  stroke: #8196a6;
}

.cad-layer.is-hidden {
  display: none;
}

.cad-entity.is-selected .cad-visible,
.cad-entity.is-selected text {
  stroke: #f59e0b;
  fill: #d97706;
  stroke-width: 2px;
}

.cad-entity.is-deleted {
  display: none;
}

.cad-source-chip,
.cad-view-hint,
.cad-editor-toolbar,
.cad-layer-panel,
.cad-properties {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(212, 212, 216, 0.9);
  background: rgba(250, 250, 250, 0.94);
  color: #52525b;
  box-shadow: 0 2px 8px rgba(24, 24, 27, 0.07);
  backdrop-filter: blur(9px);
  pointer-events: none;
}

/* 演示画布保持纯净：上方只显示 CAD / 内部结构两个视图按钮。
   编辑器本身仍保留拖动、Delete、Ctrl/Cmd+Z 等直接交互能力。 */
.cad-view .cad-source-chip,
.cad-view .cad-view-hint,
.cad-view .cad-editor-toolbar,
.cad-view .cad-layer-panel,
.cad-view .cad-properties {
  display: none !important;
}

.cad-source-chip {
  left: 16px;
  top: 15px;
  display: flex;
  align-items: baseline;
  gap: 9px;
  max-width: calc(100% - 250px);
  padding: 8px 11px;
  border-radius: 8px;
  white-space: nowrap;
}

.cad-source-chip strong {
  color: #27272a;
  font-size: 11px;
}

.cad-source-chip span {
  overflow: hidden;
  color: #71717a;
  font-size: 9px;
  text-overflow: ellipsis;
}

.cad-editor-toolbar {
  top: 64px;
  left: 16px;
  display: inline-flex;
  gap: 5px;
  padding: 5px;
  border-radius: 9px;
  pointer-events: auto;
}

.cad-editor-toolbar button {
  height: 27px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #3f3f46;
  font-size: 9px;
  cursor: pointer;
}

.cad-editor-toolbar button:hover:not(:disabled),
.cad-editor-toolbar button[aria-expanded="true"] {
  border-color: #d4d4d8;
  background: #fff;
  color: #0f5fa8;
}

.cad-editor-toolbar button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cad-layer-panel,
.cad-properties {
  top: 104px;
  width: 246px;
  max-height: min(460px, calc(100% - 190px));
  padding: 10px;
  border-radius: 9px;
  pointer-events: auto;
}

.cad-layer-panel {
  left: 16px;
}

.cad-properties {
  right: 16px;
}

.cad-layer-panel[hidden],
.cad-properties[hidden] {
  display: none;
}

.cad-layer-panel header,
.cad-properties > span,
.cad-properties > strong,
.cad-properties > small {
  display: block;
}

.cad-layer-panel header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px 8px;
}

.cad-layer-panel header strong,
.cad-properties > strong {
  color: #27272a;
  font-size: 11px;
}

.cad-layer-panel header span,
.cad-properties > span,
.cad-properties > small {
  color: #71717a;
  font-size: 9px;
}

.cad-layer-list {
  max-height: 390px;
  overflow: auto;
  display: grid;
  gap: 3px;
}

.cad-layer-row {
  min-height: 28px;
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 3px 5px;
  border-radius: 6px;
  font-size: 9px;
}

.cad-layer-row:hover {
  background: #f4f4f5;
}

.cad-layer-row input {
  margin: 0;
}

.cad-layer-row small {
  color: #a1a1aa;
}

.cad-properties > strong {
  margin-top: 3px;
}

.cad-properties > small {
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.cad-offset-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 10px;
}

.cad-offset-fields label,
.cad-text-field {
  display: grid;
  gap: 4px;
  color: #71717a;
  font-size: 8px;
}

.cad-offset-fields input,
.cad-text-field input {
  width: 100%;
  height: 28px;
  border: 1px solid #d4d4d8;
  border-radius: 6px;
  background: #fff;
  color: #27272a;
  font-size: 9px;
}

.cad-offset-fields input {
  padding: 0 6px;
}

.cad-text-field {
  margin-top: 8px;
}

.cad-text-field[hidden] {
  display: none;
}

.cad-text-field input {
  padding: 0 8px;
}

.cad-view-hint {
  left: 50%;
  bottom: 71px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 9px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.canvas-wrap.is-cad #model-canvas {
  visibility: hidden;
}

.canvas-wrap.is-cad .stage-status,
.canvas-wrap.is-cad .node-inspector {
  display: none !important;
}

.loading-state,
.empty-state {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  background: #fff;
}

.loading-state strong,
.empty-state strong {
  margin-top: 10px;
  color: var(--text-strong);
  font-size: 14px;
}

.loading-state small,
.empty-state p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.empty-state > span {
  color: #a1a1aa;
  font-size: 10px;
  letter-spacing: 0.12em;
}

.loading-ring {
  width: 28px;
  height: 28px;
  border: 2px solid #e4e4e7;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.stage-status {
  position: absolute;
  z-index: 6;
  left: 16px;
  top: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 190px);
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  box-shadow: 0 4px 15px rgba(24, 24, 27, 0.06);
  backdrop-filter: blur(8px);
  font-size: 10px;
  pointer-events: none;
}

.stage-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.stage-status > span:nth-child(2) {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-status b {
  color: var(--text-strong);
}

.hidden-stat {
  display: none;
}

.node-inspector {
  position: absolute;
  z-index: 8;
  left: 16px;
  bottom: 70px;
  min-width: 230px;
  max-width: 360px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(24, 24, 27, 0.11);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.node-inspector span,
.node-inspector strong,
.node-inspector small {
  display: block;
}

.node-inspector span {
  color: var(--muted);
  font-size: 9px;
}

.node-inspector strong {
  margin-top: 3px;
  color: var(--text-strong);
  font-size: 12px;
}

.node-inspector small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.demo-transport {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 14px;
  width: min(760px, calc(100% - 28px));
  min-height: 44px;
  display: grid;
  grid-template-columns: auto auto minmax(180px, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(212, 212, 216, 0.88);
  border-radius: 12px;
  background: rgba(250, 250, 250, 0.94);
  box-shadow: 0 10px 28px rgba(24, 24, 27, 0.12);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.play-button,
.transport-button {
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: #fff;
  padding: 0 10px;
  cursor: pointer;
  font-size: 10px;
}

.play-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 650;
}

.play-button:disabled,
.transport-button:disabled,
select:disabled,
input:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.timeline-wrap {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.timeline-control {
  position: relative;
}

#timeline-slider {
  position: relative;
  z-index: 2;
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.stage-markers {
  position: absolute;
  z-index: 1;
  inset: 8px 5px auto;
  height: 8px;
  pointer-events: none;
}

.stage-marker {
  position: absolute;
  width: 1px;
  height: 6px;
  background: rgba(63, 63, 70, 0.3);
}

#speed-select {
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: #fff;
  padding: 0 6px;
  font-size: 10px;
}

.workspace-chat-pane {
  flex: 0 0 440px;
  width: 440px;
  min-width: 440px;
  min-height: 0;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) auto;
  overflow: hidden;
  border-left: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), var(--bg));
}

.chat-tabs {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.chat-tab {
  min-width: 0;
  height: 38px;
  flex: 1;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 0 12px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.chat-tab.is-active {
  border-color: var(--border);
  background: #fff;
  color: var(--text-strong);
  font-weight: 600;
}

.chat-new,
.chat-history {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
}

.chat-new:hover,
.chat-history:hover {
  background: var(--bg-hover);
  color: var(--text-strong);
}

.chat-scroll {
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px 22px 12px;
  scroll-behavior: smooth;
}

.chat-message {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.62;
}

.chat-message--user {
  display: flex;
  justify-content: flex-end;
}

.chat-message--user p {
  width: fit-content;
  max-width: 88%;
  margin: 0;
  padding: 9px 11px;
  border-radius: 11px 11px 3px 11px;
  background: #f0f0f0;
  color: var(--text-strong);
}

.assistant-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 11px;
}

.assistant-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.reasoning-card {
  margin: 0 0 8px;
  border: 0;
}

.reasoning-card summary {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  list-style: none;
}

.reasoning-card summary::-webkit-details-marker {
  display: none;
}

.reasoning-dot,
.native-tool-dot {
  color: var(--accent);
  font-size: 17px;
  line-height: 1;
}

.reasoning-caret {
  margin-left: 2px;
  color: #a1a1aa;
  font-size: 12px;
  transform: rotate(90deg);
  transition: transform 120ms ease;
}

.reasoning-card:not([open]) .reasoning-caret {
  transform: rotate(0deg);
}

.reasoning-dots {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.reasoning-dots[hidden] {
  display: none;
}

.reasoning-dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #9ca3af;
  animation: reasoning-pulse 1.15s ease-in-out infinite;
}

.reasoning-dots i:nth-child(2) {
  animation-delay: 140ms;
}

.reasoning-dots i:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes reasoning-pulse {
  0%,
  70%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-1px);
  }
}

.reasoning-body {
  position: relative;
  max-height: 118px;
  margin: 0 0 5px 18px;
  overflow: auto;
  padding: 5px 10px 7px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.reasoning-body strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text-strong);
  font-size: 11px;
  font-weight: 600;
}

.reasoning-body p {
  display: inline;
  margin: 0;
}

.stream-cursor {
  display: inline-block;
  width: 1px;
  height: 1em;
  margin-left: 3px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 0.9s steps(1) infinite;
}

.stream-cursor[hidden] {
  display: none;
}

.native-tool-stream {
  display: grid;
  gap: 7px;
  margin: 0 0 8px;
}

.native-agent-step {
  display: grid;
  gap: 2px;
}

.native-tool-card {
  border: 0;
  border-radius: 7px;
  background: transparent;
}

.native-tool-card summary,
.native-tool-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 3px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  list-style: none;
}

.native-tool-card summary::-webkit-details-marker {
  display: none;
}

.tool-action-chip {
  max-width: 160px;
  overflow: hidden;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.native-tool-title {
  overflow: hidden;
  color: var(--text-strong);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.native-tool-status {
  color: #a1a1aa;
  font-size: 9px;
}

.native-tool-card.is-running .native-tool-status {
  color: var(--accent);
}

.native-tool-card.is-complete .native-tool-dot {
  color: #16a34a;
}

.native-tool-caret {
  color: #a1a1aa;
  transform: rotate(90deg);
  transition: transform 120ms ease;
}

.native-tool-card:not([open]) .native-tool-caret {
  transform: rotate(0deg);
}

.native-tool-body {
  margin-left: 18px;
  padding: 4px 9px 6px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.native-tool-body p {
  margin: 0;
}

.native-tool-section + .native-tool-section {
  margin-top: 7px;
}

.native-tool-section b {
  display: block;
  margin-bottom: 3px;
  color: var(--text-strong);
  font-size: 10px;
  font-weight: 600;
}

.native-tool-section pre {
  max-height: 138px;
  margin: 3px 0 0;
  overflow: auto;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: color-mix(in srgb, var(--card) 88%, #f4f4f5 12%);
  color: var(--muted);
  font: 9px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-tool-running {
  color: var(--accent);
  font: 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.chat-status-line {
  margin: 3px 0 0 18px;
  color: var(--muted);
  font-size: 10px;
}

.chat-status-line--executing::before {
  content: "·";
  margin-right: 7px;
  color: var(--accent);
  font-size: 15px;
  vertical-align: -1px;
}

.native-tool-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
  color: #a1a1aa;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.stream-placeholder {
  padding: 9px 0;
  color: #a1a1aa;
  font-size: 11px;
  line-height: 1.55;
}

.event-row {
  position: relative;
  padding: 7px 5px 7px 18px;
  border-left: 1px solid var(--border);
  animation: event-in 0.2s ease both;
}

.event-row::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 14px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a1a1aa;
}

.event-row.thought::before {
  background: var(--accent);
}

.event-row.result::before,
.event-row.complete::before {
  background: #16a34a;
}

.event-row strong {
  display: block;
  color: var(--text-strong);
  font-size: 11px;
  font-weight: 600;
}

.event-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.event-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
  color: #a1a1aa;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.model-recipe-card {
  margin: 6px 0;
  padding: 8px 10px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--card) 92%, var(--accent) 8%);
}

.model-recipe-summary {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 11px;
}

.model-recipe-summary strong {
  color: var(--text-strong);
  font-size: 12px;
}

.tool-caret {
  color: #a1a1aa;
}

.tool-icon {
  color: var(--accent);
}

.tool-phase {
  max-width: 68px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-progress {
  margin-left: auto;
  color: var(--accent);
  font-weight: 700;
}

.progress-track {
  height: 5px;
  margin: 9px 0 7px 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(113, 113, 122, 0.18);
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.22s ease-out;
}

.compile-caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 0 3px 5px 18px;
  color: var(--muted);
  font-size: 10px;
}

.compile-stream {
  max-height: 282px;
  overflow: auto;
  padding-left: 18px;
}

.compile-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  padding: 4px 2px;
  color: var(--text);
  font-size: 11px;
  line-height: 1.45;
  animation: event-in 0.18s ease both;
}

.compile-time {
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.compile-row strong {
  display: block;
  color: var(--text-strong);
  font-size: 10px;
  font-weight: 600;
}

.compile-row p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.compile-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: #a1a1aa;
  font-size: 9px;
}

.cache-tag {
  color: var(--accent);
  font-weight: 650;
}

.cache-tag.memory {
  color: var(--muted);
}

.truth-note {
  margin: 9px 0 0;
  color: #a1a1aa;
  font-size: 9px;
  line-height: 1.5;
}

.completion-message {
  color: var(--muted);
  font-size: 11px;
}

.completion-message p {
  margin: 0;
}

.chat-composer {
  position: relative;
  margin: 0 14px 14px 10px;
}

.chat-composer textarea {
  width: 100%;
  min-height: 48px;
  max-height: 110px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
  padding: 13px 42px 11px 13px;
  color: var(--text);
  outline: none;
  box-shadow: 0 5px 18px rgba(24, 24, 27, 0.05);
  font-size: 12px;
}

.chat-composer textarea:focus {
  border-color: var(--border-hover);
}

.composer-send {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--text-strong);
  color: #fff;
  font-size: 15px;
}

.hidden-evidence {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes blink {
  50% {
    opacity: 0.2;
  }
}

@keyframes event-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 980px) {
  .workspace-chat-pane {
    flex-basis: 400px;
    width: 400px;
    min-width: 400px;
  }

  .demo-transport {
    grid-template-columns: auto auto minmax(130px, 1fr) auto;
  }

  .demo-transport .transport-button:last-child,
  .demo-transport .transport-button:nth-last-child(2) {
    display: none;
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .vela-shell {
    min-height: 100vh;
    height: auto;
  }

  .demo-identity {
    display: none;
  }

  .workspace {
    display: block;
    overflow: visible;
  }

  .workspace-center-pane {
    height: 62vh;
  }

  .workspace-chat-pane {
    width: 100%;
    min-width: 0;
    height: 78vh;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .workspace-resizer {
    display: none;
  }

  .demo-transport {
    grid-template-columns: auto minmax(110px, 1fr) auto;
  }

  .demo-transport #restart-button,
  .demo-transport .transport-button:nth-last-child(-n + 2) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Vela native workspace alignment

   These overrides mirror the measured browser-mode Vela shell:
   56 px top bar, a 60/40 center-chat split, a 4 px resizable-divider gutter,
   compact tabs, an unboxed transcript, and the two-level native composer.
   The project/library pane is intentionally absent: the demo starts with the
   same nav-collapsed state used by the model workbench.
   -------------------------------------------------------------------------- */

.vela-titlebar {
  justify-content: flex-end;
  gap: 6px;
  padding: 0 20px;
  border-bottom: 1px solid #eeeeef;
  background: #fafafa;
}

.vela-runtime-status {
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid #ececee;
  border-radius: 999px;
  background: #f5f5f5;
  color: #52525b;
  font-size: 11px;
  box-shadow: inset 0 1px 0 #fff;
}

.vela-runtime-status code {
  color: #3f3f46;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
}

.runtime-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
}

.workspace-pane-toggle-group {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-strong);
  box-shadow: inset 0 1px 0 #fff;
}

.workspace-pane-toggle,
.titlebar-agent,
.theme-toggle button {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #71717a;
}

.workspace-pane-toggle svg,
.titlebar-agent svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace-pane-toggle:hover,
.titlebar-agent:hover,
.theme-toggle button:hover {
  color: #27272a;
  background: #ededee;
}

.workspace-pane-toggle--active {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.1);
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.18);
}

.titlebar-agent {
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.titlebar-agent:hover {
  background: #b91c1c;
  color: #fff;
}

.theme-toggle {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 3px;
  border-radius: 10px;
  background: #f5f5f5;
}

.theme-toggle button {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.theme-toggle button.is-active {
  color: #3f3f46;
  background: #fff;
  box-shadow: 0 1px 3px rgba(24, 24, 27, 0.08);
}

.workspace {
  gap: 4px;
  background: #f4f4f5;
}

.workspace-center-pane,
.canvas-wrap,
.loading-state,
.empty-state {
  background: #fafafa;
}

.workspace-center-pane {
  flex: 1 1 auto;
}

.workspace-chat-pane {
  flex: 0 0 calc(40% - 4px);
  width: auto;
  min-width: 440px;
  max-width: 620px;
  grid-template-rows: 40px minmax(0, 1fr) auto;
  gap: 0;
  padding: 4px 16px 16px 10px;
  border-left: 0;
  background: #f5f5f5;
}

.chat-tabs {
  gap: 4px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.chat-tab {
  width: min(190px, 62%);
  height: 34px;
  flex: 0 1 auto;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12px;
}

.chat-tab.is-active {
  border-color: #e4e4e7;
  background: #fafafa;
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.03);
}

.chat-new {
  margin-left: auto;
}

.chat-new,
.chat-history {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-size: 16px;
}

.chat-scroll {
  margin: 0 20px;
  padding: 8px 0 18px;
  border-radius: 12px;
}

.chat-message {
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.55;
}

.chat-message--user p {
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid #e4e4e7;
  border-radius: 9px;
  background: #f5f5f5;
}

.model-recipe-card {
  border-color: rgba(220, 38, 38, 0.26);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.chat-composer {
  position: relative;
  margin: 0 20px;
  padding-top: 12px;
  background: linear-gradient(180deg, transparent, #f5f5f5 24%);
}

.chat-compose-row {
  min-height: 103px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  background: #fafafa;
  box-shadow:
    0 1px 4px rgba(24, 24, 27, 0.05),
    inset 0 1px 0 #fff;
}

.chat-composer textarea {
  min-height: 39px;
  max-height: 74px;
  flex: 1 1 auto;
  padding: 8px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  line-height: 1.5;
}

.chat-composer textarea:focus {
  border: 0;
}

.chat-compose-actions {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.composer-actions-spacer {
  flex: 1;
}

.composer-model,
.composer-folder,
.composer-send {
  position: static;
  width: auto;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #3f3f46;
  font-size: 12px;
  white-space: nowrap;
}

.composer-model {
  min-width: 108px;
  justify-content: space-between;
  color: #52525b;
}

.composer-model:hover,
.composer-folder:hover {
  border-color: #e4e4e7;
  background: #f0f0f0;
}

.composer-folder {
  border-color: #e4e4e7;
  background: #fff;
}

.composer-send {
  min-width: 82px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.2);
}

.composer-send kbd {
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-family: inherit;
  font-size: 10px;
}

.stage-status {
  border-color: #e8e8ea;
  border-radius: 8px;
  background: rgba(250, 250, 250, 0.9);
  box-shadow: 0 1px 5px rgba(24, 24, 27, 0.04);
}

.stage-toggle {
  border-color: #e4e4e7;
  background: rgba(250, 250, 250, 0.94);
  box-shadow: 0 2px 8px rgba(24, 24, 27, 0.07);
}

.demo-transport {
  bottom: 14px;
  width: min(720px, calc(100% - 220px));
  border-color: #e4e4e7;
  border-radius: 10px;
  background: rgba(250, 250, 250, 0.96);
  box-shadow: 0 2px 10px rgba(24, 24, 27, 0.08);
}

@media (min-width: 761px) {
  .workspace-chat-pane {
    flex-basis: calc(40% - 4px);
    width: auto;
    min-width: 440px;
  }
}

@media (max-width: 760px) {
  .vela-titlebar {
    padding: 0 10px;
  }

  .vela-runtime-status,
  .workspace-pane-toggle-group {
    display: none;
  }

  .workspace {
    gap: 0;
  }

  .workspace-chat-pane {
    max-width: none;
    padding: 4px 10px 12px;
  }

  .chat-scroll,
  .chat-composer {
    margin-right: 8px;
    margin-left: 8px;
  }

  .demo-transport {
    width: calc(100% - 120px);
  }
}
