@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap");

/* ══════════════════════════════════════════════════════════════
   DESIGN TOKENS — Single source of truth
   ══════════════════════════════════════════════════════════════ */
:root {
  /* ── Palette ── */
  --bg-base: #060809;
  --bg-elevated: rgba(12, 14, 16, 0.82);
  --bg-surface: rgba(16, 19, 22, 0.72);
  --bg-surface-solid: #0e1012;
  --bg-hover: rgba(255, 255, 255, 0.04);
  --bg-active: rgba(255, 255, 255, 0.07);

  /* Glass */
  --glass-bg: rgb(28, 30, 32);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.14);
  --glass-blur: blur(24px) saturate(130%);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04);

  /* Accent */
  --accent: #84ffaa;
  --accent-soft: rgba(132, 255, 170, 0.12);
  --accent-softer: rgba(132, 255, 170, 0.06);
  --accent-glow: 0 0 20px rgba(132, 255, 170, 0.15);
  --accent-border: rgba(132, 255, 170, 0.25);

  /* Text */
  --text-primary: rgba(240, 246, 243, 0.96);
  --text-secondary: rgba(190, 204, 198, 0.72);
  --text-tertiary: rgba(160, 174, 168, 0.50);
  --text-bright: #f4faf7;

  /* Lines / borders */
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.04);

  /* ── Scale: Spacing ── */
  --sp-4: 4px;
  --sp-6: 6px;
  --sp-8: 8px;
  --sp-10: 10px;
  --sp-12: 12px;
  --sp-16: 16px;
  --sp-20: 20px;
  --sp-24: 24px;
  --sp-32: 32px;

  /* ── Scale: Radii ── */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 22px;
  --r-2xl: 28px;
  --r-pill: 999px;

  /* ── Typography ── */
  --font-ui: "Outfit", "Segoe UI", -apple-system, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;

  /* ── Misc ── */
  --green: #84ffaa;
  --green-soft: rgba(132, 255, 170, 0.26);
  --transition-fast: 140ms ease;
  --transition-med: 220ms ease;
  --grid-size: 25px;
  --grid-offset-x: 0px;
  --grid-offset-y: 0px;
  --workflow-rail-width: 60px;
}

/* ══════════════════════════════════════════════════════════════
   RESET
   ══════════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  font-family: var(--font-ui);
}

html,
body,
#app {
  margin: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--text-primary);
  background: var(--bg-base);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ══════════════════════════════════════════════════════════════
   STAGE / CANVAS
   ══════════════════════════════════════════════════════════════ */
.graph-stage-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  touch-action: none;
  --grid-size: 25px;
  --grid-dot: 4px;
  --grid-offset-x: 0px;
  --grid-offset-y: 0px;
  --workflow-rail-width: 60px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 120% 100% at 20% 0%, rgba(20, 40, 50, 0.18), transparent 60%),
    radial-gradient(ellipse 100% 100% at 80% 100%, rgba(15, 35, 25, 0.12), transparent 60%),
    linear-gradient(180deg, #060809 0%, #080a0c 50%, #060809 100%);
}

.graph-stage-wrap.is-panning {
  cursor: grabbing;
}

/* ══════════════════════════════════════════════════════════════
   VIEWPORT
   ══════════════════════════════════════════════════════════════ */
.graph-viewport {
  position: absolute;
  inset: 0;
  transform-origin: top left;
}

/* ══════════════════════════════════════════════════════════════
   EDGES (luminous cables)
   ══════════════════════════════════════════════════════════════ */
.edges-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
  overflow: visible;
}

.edge-group {
  pointer-events: stroke;
  cursor: pointer;
}

.edge-bloom {
  fill: none;
  stroke: var(--edge-color, var(--accent));
  stroke-width: 12px;
  vector-effect: non-scaling-stroke;
  stroke-linecap: butt;
  opacity: 0.10;
  filter: url(#edge-glow);
  pointer-events: none;
}

.edge-strand {
  fill: none;
  stroke: var(--edge-color, var(--accent));
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  pointer-events: none;
}

.edge-s1 {
  stroke-width: 1.2px;
  opacity: 0.22;
  stroke: color-mix(in srgb, var(--edge-color, var(--accent)) 25%, #888);
}

.edge-s2 {
  stroke-width: 1.0px;
  opacity: 0.18;
  stroke: color-mix(in srgb, var(--edge-color, var(--accent)) 20%, #999);
}

.edge-core {
  fill: none;
  stroke: color-mix(in srgb, var(--edge-color, var(--accent)) 90%, white);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  opacity: 0.85;
  filter: drop-shadow(0 0 1.5px color-mix(in srgb, var(--edge-color, var(--accent)) 15%, transparent));
  pointer-events: none;
}

.edge-group:hover .edge-bloom { opacity: 0.20; }
.edge-group:hover .edge-core { opacity: 1; stroke-width: 2.2px; }
.edge-group:hover .edge-s1,
.edge-group:hover .edge-s2 { opacity: 0.38; }

/* Invisible fat hit target for reliable hover on a thin curve */
.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 22px;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  pointer-events: stroke;
  cursor: pointer;
}

/* Delete button that appears at the edge midpoint on hover */
.edge-delete {
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  transform-box: fill-box;
  cursor: pointer;
}
.edge-group:hover .edge-delete {
  opacity: 1;
  pointer-events: auto;
}
.edge-delete-halo {
  fill: transparent;
  stroke: rgba(110, 110, 120, 0.95);
  stroke-width: 1.25;
  pointer-events: none;
}
.edge-delete-bg {
  fill: rgba(110, 110, 120, 0.95);
  stroke: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}
.edge-delete-x {
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
  pointer-events: none;
}
.edge-delete:hover .edge-delete-bg {
  fill: rgba(200, 70, 70, 0.98);
}
.edge-delete:hover .edge-delete-halo {
  stroke: rgba(200, 70, 70, 0.98);
}

/* ── Edge anchors (rendered in overlay layer z-index 3) ── */
.edge-anchor-spread {
  fill: var(--edge-color, var(--accent));
  opacity: 0.35;
  filter: url(#ol-anchor-spread-glow);
  pointer-events: none;
}

.edge-anchor-glow {
  fill: var(--edge-color, var(--accent));
  opacity: 0.75;
  filter: url(#ol-anchor-glow);
  pointer-events: none;
}

.edge-anchor-fill {
  fill: var(--edge-color, var(--accent));
  opacity: 1;
  pointer-events: none;
}

.edge-anchor-wing-spread {
  fill: none;
  stroke: var(--edge-color, var(--accent));
  stroke-width: 6;
  opacity: 0.3;
  filter: url(#ol-anchor-spread-glow);
  pointer-events: none;
}

.edge-anchor-wing-glow {
  fill: none;
  stroke: var(--edge-color, var(--accent));
  stroke-width: 4;
  opacity: 0.6;
  filter: url(#ol-wing-glow);
  pointer-events: none;
}

.edge-anchor-wing-fill {
  fill: var(--edge-color, var(--accent));
  opacity: 1;
  pointer-events: none;
}

.edge-group:hover .edge-anchor-spread { opacity: 0.5; }
.edge-group:hover .edge-anchor-glow { opacity: 0.7; }
.edge-group:hover .edge-anchor-wing-glow { opacity: 0.85; }
.edge-group:hover .edge-anchor-fill { opacity: 1; }

.edge-anchor-hit {
  fill: transparent;
  stroke: none;
  pointer-events: auto;
  cursor: grab;
}
.edge-anchor-hit:active {
  cursor: grabbing;
}

/* ── Edge labels ── */
.edge-label {
  pointer-events: none;
}

.edge-label-text {
  fill: #ffffff;
  font-size: 16px;
  font-family: inherit;
  font-weight: 300;
  text-anchor: middle;
  dominant-baseline: central;
  letter-spacing: 0.3px;
}

.edge-label-bg {
  fill: rgb(20, 20, 22);
  stroke: none;
}

/* ── Edge preview ── */
.edge-preview-group {
  pointer-events: none;
  opacity: 0;
  transition: opacity 100ms ease;
}

.edge-preview-group.visible { opacity: 1; }

.edge-preview-glow {
  fill: none;
  stroke: rgba(255, 255, 255, 1);
  stroke-width: 12px;
  opacity: 0.10;
  vector-effect: non-scaling-stroke;
  stroke-linecap: butt;
  filter: url(#edge-glow-preview);
}

.edge-preview-core {
  fill: none;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  opacity: 0.85;
  filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, 0.35));
}

.edge-preview-anchor {
  fill: rgba(255, 255, 255, 0.98);
  stroke: none;
  filter:
    drop-shadow(0 0 3px rgba(255, 255, 255, 0.55))
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.35));
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════
   NODES
   ══════════════════════════════════════════════════════════════ */
.nodes-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.nodes-layer > .graph-node {
  pointer-events: auto;
}

.anchors-overlay-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  overflow: visible;
}

.graph-node {
  --kind-color: #86f8a6;
  --node-glow: rgba(134, 248, 166, 0.20);
  position: absolute;
  width: 300px;
  isolation: isolate;
  transform: rotate(var(--node-tilt, 0deg));
  transform-origin: center;
  transition: transform var(--transition-fast);
  animation: node-in 300ms ease both;
}

.graph-node:hover {
  transform: rotate(var(--node-tilt, 0deg));
}

.graph-stage-wrap.is-2d .graph-node:hover {
  transform: rotate(0deg);
}

/* ── Node backplate (outer glass halo) ── */
.node-backplate {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: var(--r-2xl);
  pointer-events: none;
  z-index: -1;
  background: transparent;
  backdrop-filter: none;
}

.node-backplate-1 {
  inset: -15px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.02),
    0 20px 40px rgba(0, 0, 0, 0.22);
  transform: none;
}

.node-backplate-2 {
  display: none;
}

.graph-stage-wrap.is-2d .node-backplate-1 {
  transform: none;
}

/* ── Node surface (main glass card) ── */
.node-surface {
  position: relative;
  z-index: 1;
  border-radius: 26px;
  min-height: 178px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: var(--glass-bg);
  backdrop-filter: none;
  box-shadow: var(--glass-shadow);
  padding: var(--sp-20);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.graph-node:hover .node-surface {
  border-color: var(--glass-border-hover);
}


.graph-stage-wrap.is-editor-mode .node-surface {
  cursor: grab;
}

.graph-stage-wrap.is-editor-mode .node-surface:active {
  cursor: grabbing;
}

/* ── Node header ── */
.node-header {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  user-select: none;
  text-align: left;
  z-index: 1;
  pointer-events: none;
}

.node-header * {
  pointer-events: auto;
}

.graph-node.is-agents-view .node-header {
  cursor: default;
}

/* ── Node actions (edit/delete) ── */
.node-action {
  position: absolute;
  top: var(--sp-16);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 2;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.node-action:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.node-action svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: none;
}

.node-action-edit {
  left: var(--sp-16);
}

.node-action-delete {
  right: var(--sp-16);
  color: rgba(255, 160, 170, 0.75);
}

.node-action-delete:hover {
  color: rgba(255, 200, 206, 0.95);
  background: rgba(255, 100, 110, 0.08);
}

/* ── Node meta ── */
.node-meta {
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.node-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-16);
}

.node-title-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
}

.node-title-icon {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  color: var(--text-primary);
  opacity: 0.88;
}

.node-title-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: none;
}

.node-kind {
  margin: 0;
  font-size: 15px;
  font-weight: 200;
  line-height: 1.1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.node-title {
  margin: 0;
  font-size: 22px;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-bright);
  text-wrap: balance;
  max-width: 100%;
}

.node-check {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--kind-color);
  font-size: 20px;
}

/* ── Node live chips ── */
.node-live {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-6);
  margin-top: var(--sp-10);
}

.node-live p {
  margin: 0;
  font-size: 12px;
  color: var(--text-tertiary);
}

.chip {
  border-radius: var(--r-pill);
  padding: 4px var(--sp-10);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  backdrop-filter: blur(12px);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.chip-model    { border-color: rgba(132, 255, 170, 0.25); color: rgba(170, 255, 200, 0.88); }
.chip-skill    { border-color: rgba(120, 210, 255, 0.25); color: rgba(160, 225, 255, 0.88); }
.chip-tool     { border-color: rgba(200, 220, 255, 0.25); color: rgba(210, 230, 255, 0.88); }
.chip-subagent { border-color: rgba(132, 255, 170, 0.20); color: rgba(170, 255, 200, 0.80); }
.chip-capability { border-color: rgba(255, 212, 123, 0.24); color: rgba(255, 226, 166, 0.92); }
.chip-capability-native { border-color: rgba(255, 212, 123, 0.34); color: rgba(255, 228, 175, 0.98); }
.chip-capability-local { border-color: rgba(255, 239, 168, 0.24); color: rgba(255, 240, 188, 0.92); }
.chip-capability-hybrid { border-color: rgba(255, 196, 120, 0.34); color: rgba(255, 223, 168, 0.98); }
.chip-capability-unavailable { border-color: rgba(255, 120, 120, 0.22); color: rgba(255, 170, 170, 0.88); }

/* ══════════════════════════════════════════════════════════════
   PORTS
   ══════════════════════════════════════════════════════════════ */
.node-ports {
  position: absolute;
  top: -15px;
  bottom: -15px;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  pointer-events: none;
  width: 0;
}

.node-ports-in  { left: -15px; }
.node-ports-out { right: -15px; }

.port {
  border: none;
  border-radius: 0;
  background: transparent;
  color: transparent;
  font-size: 0;
  display: block;
  padding: 0;
  width: 12px;
  height: 12px;
  cursor: crosshair;
  pointer-events: auto;
  position: relative;
}

.node-ports-in .port  { transform: translateX(-6px); }
.node-ports-out .port { transform: translateX(-6px); }

.port:hover    { border-color: transparent; }
.port-dot      { display: none; }
.port-out      { flex-direction: row-reverse; }
.port-label    { display: none; }

/* Floating handle that appears when hovering on a node's contour (workflow view)
   Clicking it starts a peer link, which can be dropped anywhere on another agent. */
.peer-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  margin-top: -8px;
  border-radius: 50%;
  border: none;
  background: rgba(110, 110, 120, 0.95);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  opacity: 0;
  transform: scale(calc(0.6 * var(--cam-zoom, 1)));
  transform-origin: center center;
  transition: opacity 90ms ease, transform 120ms ease, background 120ms ease;
  pointer-events: none;
  cursor: default;
  z-index: 6;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.peer-handle::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1.25px solid rgba(110, 110, 120, 0.95);
  pointer-events: none;
}
.peer-handle.visible {
  opacity: 1;
  transform: scale(var(--cam-zoom, 1));
  pointer-events: auto;
}
.peer-handle.visible:hover {
  background: rgba(140, 140, 150, 0.98);
  transform: scale(calc(1.1 * var(--cam-zoom, 1)));
}
.peer-handle svg {
  width: 11px;
  height: 11px;
}

/* Target node highlight while dragging a peer link */
.graph-node.is-peer-target .node-backplate-1 {
  border-color: rgba(199, 123, 255, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.02),
    0 0 22px rgba(199, 123, 255, 0.55),
    0 20px 40px rgba(0, 0, 0, 0.22);
}

.node-id {
  display: none;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════
   QUICK CREATE RAIL (top bar)
   ══════════════════════════════════════════════════════════════ */
.quick-create {
  position: absolute;
  top: var(--sp-24);
  left: var(--sp-24);
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-8);
  max-height: calc(100vh - var(--sp-24) * 2 - 52px - var(--sp-24));
}

.quick-create button {
  position: relative;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
  height: 52px;
  padding: 0 var(--sp-16);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.quick-create button:hover {
  color: var(--text-bright);
  border-color: var(--glass-border-hover);
}

.rail-plus {
  width: 52px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
}

.rail-plus svg {
  width: 36px;
  height: 36px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Workflow list ── */
.workflow-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-8);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: var(--sp-4);
  scrollbar-width: none;
}

.workflow-list::-webkit-scrollbar { display: none; }

.workflow-shortcut {
  color: var(--text-secondary);
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  padding: 0;
  aspect-ratio: 1 / 1;
}

.workflow-shortcut.is-active {
  color: var(--green);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.workflow-shortcut.is-active .workflow-shortcut-label svg {
  stroke: var(--green);
  width: 22px;
  height: 22px;
}

.workflow-shortcut-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.workflow-shortcut-label svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workflow-shortcut-name {
  display: none;
}

.workflow-shortcut-shine {
  display: none;
}

/* ══════════════════════════════════════════════════════════════
   MODE TABS (top center)
   ══════════════════════════════════════════════════════════════ */
.mode-tabs {
  position: absolute;
  top: var(--sp-20);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: none;
  border-radius: var(--r-lg);
  padding: 3px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  gap: var(--sp-4);
}

.mode-tabs button {
  border: 0;
  min-width: 80px;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-secondary);
  padding: 12px var(--sp-16);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.mode-tabs button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mode-tabs button.is-active {
  color: var(--text-bright);
  background: var(--bg-active);
  border: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════
   DETAIL AGENT HEADER (top-left info)
   ══════════════════════════════════════════════════════════════ */
.detail-agent-header {
  --detail-header-tint: #81f8a1;
  position: absolute;
  top: calc(var(--sp-24) + var(--sp-8));
  left: calc(var(--sp-24) + 52px + var(--sp-24));
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-16);
  max-width: min(560px, calc(100vw - 460px));
  pointer-events: none;
}

.detail-agent-header[hidden] { display: none; }

.detail-agent-topline {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-12);
}

.detail-agent-copy { min-width: 0; }

.detail-agent-title-row {
  display: flex;
  align-items: center;
  gap: var(--sp-10);
  min-width: 0;
}

.detail-agent-title,
.detail-agent-handle { margin: 0; }

.detail-agent-title {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text-bright);
  text-wrap: balance;
  pointer-events: auto;
  cursor: pointer;
}

.detail-agent-title-edit {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  backdrop-filter: blur(14px);
  box-shadow: var(--glass-shadow);
  pointer-events: auto;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.detail-agent-title-edit:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.detail-agent-title-edit svg {
  width: 18px;
  height: 18px;
}

.detail-agent-rename {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
  pointer-events: auto;
}

.detail-agent-rename[hidden] { display: none; }

.detail-agent-rename-input {
  min-width: min(320px, calc(100vw - 220px));
  flex: 1 1 280px;
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-border);
  background: rgba(5, 6, 10, 0.56);
  color: var(--text-bright);
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.detail-agent-rename-input:focus {
  border-color: color-mix(in srgb, var(--detail-header-tint) 52%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--detail-header-tint) 18%, transparent);
}

.detail-agent-rename-save,
.detail-agent-rename-cancel {
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  padding: 10px 14px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.detail-agent-rename-save:hover,
.detail-agent-rename-cancel:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
}

.detail-agent-handle {
  margin-top: var(--sp-4);
  min-height: 24px;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.1;
  color: var(--text-secondary);
}

.detail-agent-role {
  display: none;
}

/* ══════════════════════════════════════════════════════════════
   MODEL EDITOR MODAL
   ══════════════════════════════════════════════════════════════ */
.model-editor-modal {
  position: absolute;
  inset: 0;
  z-index: 12;
}

.model-editor-modal[hidden] { display: none; }

.model-editor-modal .model-editor-dialog {
  width: min(780px, calc(100vw - 48px));
  padding: var(--sp-32);
}

.model-editor-modal .model-editor-list {
  max-height: min(520px, calc(100vh - 280px));
  padding: 8px 5px 8px 10px;
}

.model-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.50);
  backdrop-filter: blur(12px);
}

.model-editor-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  border-radius: var(--r-2xl);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), var(--glass-shadow);
  padding: var(--sp-24);
}

.model-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-16);
}

.model-editor-copy { min-width: 0; }

.model-editor-eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.model-editor-title {
  margin: var(--sp-6) 0 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-bright);
}

.model-editor-close {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-hover);
  backdrop-filter: blur(12px);
  color: var(--text-secondary);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

.model-editor-close:hover {
  color: var(--text-primary);
  background: var(--bg-active);
  border-color: var(--glass-border-hover);
}

.model-editor-field {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
}

.model-editor-field span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.model-editor-select {
  width: 100%;
  height: 48px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  padding: 0 var(--sp-12);
  font: inherit;
  font-size: 14px;
  transition: border-color var(--transition-fast);
}

.model-editor-select:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.model-editor-field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.model-editor-field-help {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-tertiary);
}

.model-editor-list-outer {
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  padding: 8px 6px;
  margin-top: 4px;
  overflow: hidden;
}

.model-editor-list {
  max-height: 320px;
  overflow-y: auto;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
  color-scheme: dark;
  scrollbar-color: #888 transparent;
}

.model-editor-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.model-editor-group-label {
  padding: var(--sp-4) var(--sp-8);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.model-editor-option {
  display: grid;
  grid-template-columns: 20px 1fr auto auto;
  align-items: center;
  gap: var(--sp-8);
  padding: var(--sp-8) var(--sp-10);
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.model-editor-option:hover {
  background: var(--bg-hover);
}

.model-editor-option.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.model-editor-option.is-primary {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.model-editor-option-check {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--accent);
}

.model-editor-option.is-selected .model-editor-option-check {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.model-editor-option-check.is-empty {
  display: inline-block;
}

.model-editor-option-name {
  font-weight: 500;
}

.model-editor-option-api {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}

.model-editor-option-metrics {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}

.model-editor-option-metric {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.model-editor-option-metric-wer {
  color: #5eead4;
  border-color: color-mix(in srgb, #5eead4 35%, var(--border));
  background: color-mix(in srgb, #5eead4 10%, transparent);
}

.model-editor-option-metric-price {
  color: #ffe258;
  border-color: color-mix(in srgb, #ffe258 35%, var(--border));
  background: color-mix(in srgb, #ffe258 10%, transparent);
}

.model-editor-option-metric-intel {
  color: #a5b4fc;
  border-color: color-mix(in srgb, #a5b4fc 35%, var(--border));
  background: color-mix(in srgb, #a5b4fc 10%, transparent);
}

.model-editor-option-metric-tbd {
  text-decoration: line-through;
  opacity: 0.65;
}

.model-editor-option.is-unavailable {
  text-decoration: line-through;
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.4);
}

.model-editor-option.is-unavailable:hover {
  background: inherit;
  border-color: inherit;
}

.model-editor-option-primary {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.model-editor-option-local {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  color: #86efac;
  border: 1px solid color-mix(in srgb, #86efac 35%, var(--border));
  background: color-mix(in srgb, #86efac 12%, transparent);
}

.model-editor-option-setprimary {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-tertiary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.model-editor-option-setprimary:hover {
  color: var(--accent);
  border-color: var(--accent-border);
}

.model-editor-meta-empty {
  display: block;
  color: var(--text-tertiary);
  font-size: 12px;
}

.model-editor-meta-count {
  margin-top: var(--sp-8);
  font-size: 11px;
  color: var(--text-tertiary);
}

.model-editor-meta {
  margin-top: var(--sp-12);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  padding: var(--sp-12);
}

.model-editor-meta p,
.model-editor-meta span,
.model-editor-meta small {
  margin: 0;
  display: block;
}

.model-editor-meta p {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}

.model-editor-meta span {
  margin-top: var(--sp-6);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.model-editor-meta small {
  margin-top: var(--sp-8);
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.45;
}

.model-editor-meta code {
  font-family: var(--font-mono);
  font-size: 12px;
}

.model-editor-actions {
  margin-top: var(--sp-20);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-10);
}

.model-editor-btn {
  height: 44px;
  border-radius: var(--r-md);
  padding: 0 var(--sp-20);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.model-editor-btn.is-ghost {
  border: 1px solid var(--border);
  background: var(--bg-hover);
  backdrop-filter: blur(12px);
  color: var(--text-secondary);
}

.model-editor-btn.is-ghost:hover {
  border-color: var(--glass-border-hover);
  color: var(--text-primary);
  background: var(--bg-active);
}

.model-editor-btn.is-primary {
  border: 1px solid var(--accent-border);
  background: linear-gradient(180deg, rgba(50, 120, 70, 0.85), rgba(30, 75, 45, 0.90));
  color: var(--text-bright);
  box-shadow: 0 4px 16px rgba(132, 255, 170, 0.10);
}

.model-editor-btn.is-primary:hover {
  box-shadow: 0 4px 20px rgba(132, 255, 170, 0.18);
  border-color: rgba(132, 255, 170, 0.35);
}

/* ── AI Agent Editor Modal (reuses model-editor-dialog styles) ── */
.aiagent-editor-modal {
  position: absolute;
  inset: 0;
  z-index: 12;
}

.aiagent-editor-modal[hidden] { display: none; }

.aiagent-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.50);
  backdrop-filter: blur(12px);
}

.aiagent-editor-options {
  display: grid;
  gap: 12px;
}

.aiagent-editor-option {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.aiagent-editor-option:hover {
  border-color: rgba(132,255,170,0.35);
  background: rgba(132,255,170,0.08);
  transform: translateY(-1px);
}

.aiagent-editor-option.is-active {
  border-color: rgba(132,255,170,0.55);
  background: rgba(132,255,170,0.12);
  box-shadow: 0 0 0 1px rgba(132,255,170,0.10) inset;
}

.aiagent-editor-option strong,
.aiagent-editor-option span {
  display: block;
}

.aiagent-editor-option strong {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-bright);
}

.aiagent-editor-option span {
  margin-top: 6px;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* ── Node Rename Modal (reuses model-editor-dialog styles) ── */
.node-rename-modal {
  position: absolute;
  inset: 0;
  z-index: 12;
}
.node-rename-modal[hidden] { display: none; }
.node-rename-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.50);
  backdrop-filter: blur(12px);
}
.node-rename-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.node-rename-input:focus {
  border-color: rgba(132,255,170,0.5);
  box-shadow: 0 0 0 3px rgba(132,255,170,0.08);
}
.node-rename-system-prompt-field[hidden] { display: none; }
.node-rename-system-prompt-input {
  width: 100%;
  min-height: 140px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
.node-rename-system-prompt-input:focus {
  border-color: rgba(132,255,170,0.5);
  box-shadow: 0 0 0 3px rgba(132,255,170,0.08);
}
.node-rename-system-prompt-help {
  margin: 6px 0 0;
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  line-height: 1.4;
}
.node-rename-preview[hidden] { display: none; }
.node-rename-preview {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.node-rename-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 12px;
}
.node-rename-preview-title {
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}
.node-rename-preview-status {
  color: rgba(132,255,170,0.8);
  font-size: 11px;
}
.node-rename-preview-body {
  margin: 0;
  padding: 10px 12px;
  max-height: 260px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.55;
  color: rgba(255,255,255,0.82);
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ══════════════════════════════════════════════════════════════
   SETTINGS MODAL
   ══════════════════════════════════════════════════════════════ */
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-24);
}
.settings-modal[hidden] {
  display: none;
}
.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.settings-dialog {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 24px;
  border-radius: 16px;
  background: rgba(18, 22, 28, 0.96);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  color: rgba(255,255,255,0.9);
}
.settings-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-dialog h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-field label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
}
.settings-default-agent-prompt {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.92);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.settings-default-agent-prompt:focus {
  border-color: rgba(132,255,170,0.55);
  box-shadow: 0 0 0 3px rgba(132,255,170,0.15);
}
.settings-field-help {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255,255,255,0.6);
}
.settings-field-help code {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.85);
}
.settings-status {
  min-height: 16px;
  font-size: 12px;
  color: rgba(132,255,170,0.85);
}
.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ══════════════════════════════════════════════════════════════
   VIEW CONTROLS (top-right)
   ══════════════════════════════════════════════════════════════ */
.view-controls {
  position: absolute;
  top: var(--sp-24);
  right: var(--sp-24);
  z-index: 6;
  display: flex;
  align-items: stretch;
  gap: var(--sp-8);
}

/* ── Status toggle ── */
.status-toggle {
  display: inline-flex;
  align-items: center;
  width: 116px;
  height: 52px;
  padding: 3px;
  border-radius: var(--r-lg);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.status-toggle-pill {
  min-width: 72px;
  height: 44px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-bright);
  position: absolute;
  top: 3px;
  left: 3px;
  background:
    radial-gradient(90% 120% at 30% 22%, rgba(139, 255, 132, 0.30), transparent 42%),
    linear-gradient(180deg, #4ab44a 0%, #26882d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 16px rgba(60, 170, 67, 0.15);
  transition:
    transform 200ms ease,
    background 200ms ease,
    color 200ms ease,
    box-shadow 200ms ease;
}

.status-toggle.is-active .status-toggle-pill {
  transform: translateX(36px);
}

.status-toggle.is-inactive .status-toggle-pill {
  transform: translateX(0);
  color: var(--text-secondary);
  background: var(--bg-active);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ── View mode toggle ── */
.view-mode-toggle {
  position: static;
  display: inline-flex;
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  padding: 3px;
  gap: var(--sp-4);
}

.view-mode-toggle button {
  border: 0;
  min-width: 52px;
  padding: 12px var(--sp-16);
  border-radius: var(--r-md);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.view-mode-toggle button.is-active {
  color: var(--text-bright);
  background: var(--bg-active);
  border: 1px solid var(--glass-border-hover);
}

/* ── Settings button ── */
.view-settings-btn {
  position: static;
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.view-settings-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view-settings-btn:hover {
  color: var(--text-bright);
  border-color: var(--glass-border-hover);
}

.chat-panel-toggle {
  position: static;
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.chat-panel-toggle[hidden] { display: none; }

.chat-panel-toggle svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-panel-toggle:hover {
  color: var(--text-bright);
  border-color: var(--glass-border-hover);
}

.chat-panel-toggle.is-active {
  color: var(--text-bright);
  background: var(--bg-active);
  border-color: var(--glass-border-hover);
}

/* ══════════════════════════════════════════════════════════════
   SYNC INDICATOR
   ══════════════════════════════════════════════════════════════ */
.sync-indicator {
  display: none;
  color: var(--text-secondary);
}

/* ══════════════════════════════════════════════════════════════
   NEXT PANEL (right sidebar)
   ══════════════════════════════════════════════════════════════ */
.next-panel {
  position: absolute;
  top: calc(var(--sp-24) + 52px + var(--sp-16));
  right: var(--sp-24);
  z-index: 6;
  width: min(420px, calc(100vw - 48px));
  max-height: calc(100vh - var(--sp-24) - 52px - var(--sp-16) - var(--sp-20));
  overflow-y: auto;
  border-radius: var(--r-xl);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  padding: var(--sp-16) var(--sp-16) var(--sp-12);
}

.next-panel[hidden] { display: none; }

.next-panel::-webkit-scrollbar {
  width: 4px;
}

.next-panel::-webkit-scrollbar-track {
  background: transparent;
}

.next-panel::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-pill);
}

.next-panel h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ── Search ── */
.next-search {
  margin-top: var(--sp-12);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  color: var(--text-tertiary);
  font-size: 14px;
  padding: var(--sp-10) var(--sp-12);
  display: flex;
  align-items: center;
  gap: var(--sp-10);
  transition: border-color var(--transition-fast);
}

.next-search:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-softer);
}

.next-search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
}

.next-search-input::placeholder {
  color: var(--text-tertiary);
}

.next-search-icon,
.next-item-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  color: var(--text-secondary);
}

.next-search-icon svg,
.next-item-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── List items ── */
.next-panel ul {
  list-style: none;
  margin: var(--sp-12) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.next-panel ul[hidden] { display: none; }

.next-panel li {
  display: flex;
  align-items: center;
  gap: var(--sp-16);
  padding: var(--sp-8) var(--sp-6);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.next-panel li[hidden] { display: none; }

.next-panel li:hover {
  background: var(--bg-hover);
}

.next-panel-action {
  cursor: pointer;
}

.next-panel-action.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.next-panel-action--primary {
  appearance: none;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-lg);
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 8px 0;
  width: 100%;
  text-align: left;
  font: inherit;
}

.next-panel-action--primary:hover {
  background: var(--accent);
  color: var(--bg-base, #0b0f14);
  border-color: var(--accent);
}

.next-item-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.next-panel li p {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.next-item-copy span {
  display: block;
  margin-top: 2px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.3;
}

.next-panel li b {
  margin-left: auto;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.next-panel li b:hover {
  border-color: var(--glass-border-hover);
  background: var(--bg-active);
}

.next-panel li b svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
}

/* ── Item stack ── */
.next-item-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-12);
}

.next-item-head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-10);
}

/* ── Tool catalog ── */
.next-tool-catalog {
  display: flex;
  flex-direction: column;
  gap: var(--sp-10);
  padding-left: 34px;
}

.next-tool-entry {
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  padding: var(--sp-12);
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.next-tool-topline {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-10);
}

.next-tool-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.next-tool-meta p {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.next-tool-meta span {
  margin-top: 2px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.35;
}

.next-tool-status {
  margin-left: auto;
  flex: 0 0 auto;
  border-radius: var(--r-pill);
  padding: 4px var(--sp-10);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.next-tool-status.is-configured {
  color: rgba(170, 255, 200, 0.92);
  background: rgba(50, 120, 70, 0.20);
  border-color: rgba(132, 255, 170, 0.20);
}

.next-tool-status.is-pending {
  color: rgba(255, 225, 160, 0.92);
  background: rgba(120, 95, 30, 0.18);
  border-color: rgba(255, 210, 100, 0.18);
}

.next-tool-command-grid {
  margin-top: var(--sp-10);
  display: grid;
  gap: var(--sp-6);
}

.next-tool-command-grid code,
.next-tool-binary code {
  font-family: var(--font-mono);
  font-size: 11px;
}

.next-tool-command-grid code {
  display: block;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.30);
  color: var(--text-primary);
  padding: var(--sp-6) var(--sp-8);
  overflow-x: auto;
}

.next-tool-foot {
  margin-top: var(--sp-10);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  color: var(--text-tertiary);
  font-size: 11px;
}

.next-tool-links {
  margin-top: var(--sp-10);
  display: flex;
  gap: var(--sp-8);
}

.next-tool-links a,
.next-tool-links span {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  padding: var(--sp-6) var(--sp-10);
  background: var(--bg-surface);
  backdrop-filter: blur(8px);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.next-tool-links a:hover {
  border-color: var(--glass-border-hover);
  background: var(--bg-active);
}

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

.next-panel-back {
  margin-top: var(--sp-12);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  border: none;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-fast);
}

.next-panel-back:hover {
  color: var(--accent);
}

.next-catalog-list {
  margin-top: 0;
}

.next-tool-entry-button {
  width: 100%;
  text-align: left;
  cursor: pointer;
  appearance: none;
  color: inherit;
}

.next-tool-entry-button:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-1px);
}

.next-empty-state {
  margin-top: var(--sp-12);
  border-radius: var(--r-md);
  border: 1px dashed var(--border-strong);
  padding: var(--sp-16);
  background: var(--bg-hover);
}

.next-empty-state p,
.next-empty-state span { margin: 0; }

.next-empty-state span {
  display: block;
  margin-top: var(--sp-4);
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ══════════════════════════════════════════════════════════════
   PROGRESS CARD (bottom-right)
   ══════════════════════════════════════════════════════════════ */
.progress-card {
  position: absolute;
  right: var(--sp-24);
  bottom: var(--sp-24);
  z-index: 5;
  width: 350px;
  border-radius: var(--r-xl);
  border: 1px solid var(--accent-border);
  background:
    radial-gradient(110% 160% at 0% 100%, rgba(100, 210, 120, 0.35), transparent 65%),
    var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  padding: var(--sp-16) var(--sp-16) var(--sp-12);
  box-shadow: var(--glass-shadow), var(--accent-glow);
}

.progress-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-12);
}

.progress-head p { margin: 0; }

.progress-head p span {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.progress-head p strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
}

.progress-percent {
  margin-top: var(--sp-6);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.progress-track {
  margin-top: var(--sp-10);
  height: 10px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.progress-fill {
  display: block;
  height: 100%;
  width: 32.4%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), rgba(89, 226, 124, 0.90));
  box-shadow: 0 0 12px var(--accent-soft);
  transition: width 260ms ease;
}

.progress-scale {
  margin-top: var(--sp-6);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
}

/* ══════════════════════════════════════════════════════════════
   BOTTOM ACTIONS BAR
   ══════════════════════════════════════════════════════════════ */
.bottom-actions {
  position: absolute;
  bottom: var(--sp-20);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-6);
  border-radius: var(--r-lg);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 3px;
  padding-right: var(--sp-8);
}

.bottom-actions button,
.bottom-actions span {
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 11px var(--sp-16);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-ui);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.bottom-actions button.is-active {
  background: var(--bg-active);
  border: 1px solid var(--border);
  color: var(--text-bright);
}

.bottom-actions button {
  cursor: pointer;
}

.bottom-actions button:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.bottom-actions .zoom-btn {
  padding: var(--sp-6);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
}

.bottom-actions .zoom-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-actions .clock-pill {
  background: rgba(50, 120, 70, 0.25);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  font-family: var(--font-mono);
  font-weight: 600;
}

.bottom-actions .node-count {
  font-family: var(--font-mono);
  color: var(--text-tertiary);
}

/* ══════════════════════════════════════════════════════════════
   EXECUTION CHAT PANEL
   ══════════════════════════════════════════════════════════════ */
.execution-chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 59;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  animation: chat-backdrop-in 0.18s ease-out;
}

.execution-chat-backdrop[hidden] { display: none; }

@keyframes chat-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.execution-chat-panel {
  position: absolute;
  left: calc(var(--sp-24) + 52px + var(--sp-12));
  top: calc(var(--sp-24) + 52px + var(--sp-32) + var(--sp-32) + var(--sp-16));
  bottom: var(--sp-24);
  z-index: 6;
  width: min(540px, calc(100vw - 48px));
  border-radius: var(--r-xl);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom left;
  transition:
    width 0.22s ease,
    transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.22s ease,
    visibility 0s linear 0s;
}

.execution-chat-panel.is-expanded {
  position: fixed;
  top: 5vh;
  left: 5vw;
  right: 5vw;
  bottom: 5vh;
  width: 90vw;
  height: 90vh;
  z-index: 60;
  border-radius: var(--r-xl);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.execution-chat-panel[hidden] {
  display: flex;
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  pointer-events: none;
  visibility: hidden;
  transition:
    width 0.22s ease,
    transform 0.2s cubic-bezier(0.4, 0, 1, 1),
    opacity 0.18s ease,
    visibility 0s linear 0.2s;
}

.execution-chat-restore {
  position: absolute;
  left: var(--sp-24);
  bottom: var(--sp-24);
  z-index: 6;
  width: 52px;
  height: 52px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  color: var(--text-secondary);
  cursor: pointer;
  transform-origin: bottom left;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast),
    background var(--transition-fast),
    transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.18s ease,
    visibility 0s linear 0s;
}

.execution-chat-restore[hidden] {
  display: grid;
  opacity: 0;
  transform: translateY(10px) scale(0.85);
  pointer-events: none;
  visibility: hidden;
  transition:
    transform 0.18s cubic-bezier(0.4, 0, 1, 1),
    opacity 0.15s ease,
    visibility 0s linear 0.18s;
}

.execution-chat-restore:hover {
  color: var(--text-bright);
  border-color: var(--glass-border-hover);
}

.execution-chat-restore svg {
  width: 22px;
  height: 22px;
}

.execution-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-12);
  padding: 8px 8px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.execution-chat-head-left {
  display: flex;
  align-items: center;
  gap: 1;
  min-width: 0;
  flex: 1 1 auto;
}

.execution-chat-head-right {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-shrink: 0;
}

.execution-chat-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  padding: 0;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.execution-chat-icon-btn svg {
  width: 18px;
  height: 18px;
}

.execution-chat-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-bright);
  border-color: var(--border-subtle);
}

.execution-chat-icon-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border);
}

.execution-chat-agent-picker-wrap {
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
}

.execution-chat-agent-picker {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-6);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--text-bright);
  padding: 8px 10px 8px 14px;
  cursor: pointer;
  max-width: 100%;
  min-width: 0;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.execution-chat-agent-picker:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
}

.execution-chat-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.execution-chat-picker-chevron {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform 0.18s ease;
}

.execution-chat-panel.is-picker-open .execution-chat-picker-chevron {
  transform: rotate(180deg);
}

.execution-chat-agent-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 4;
  min-width: 240px;
  max-width: 360px;
  max-height: 320px;
  overflow-y: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-surface-strong, var(--bg-surface));
  backdrop-filter: blur(20px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.execution-chat-agent-menu[hidden] { display: none; }

.execution-chat-agent-menu-empty {
  margin: 0;
  padding: var(--sp-12);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
}

.execution-chat-agent-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: var(--sp-8) var(--sp-10);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.execution-chat-agent-option:hover {
  background: var(--bg-hover);
}

.execution-chat-agent-option.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.execution-chat-agent-option-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
}

.execution-chat-agent-option-kind {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.execution-chat-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

.execution-chat-rail {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-subtle);
  padding: var(--sp-10) var(--sp-8);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  background: rgba(255, 255, 255, 0.02);
}

.execution-chat-rail[hidden] { display: none; }

.execution-chat-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  padding: 0 var(--sp-6);
  margin-bottom: var(--sp-4);
}

.execution-chat-rail-title {
  margin: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}

.execution-chat-rail-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.execution-chat-rail-new:hover {
  background: var(--bg-hover);
  color: var(--text-bright);
  border-color: var(--border-strong);
}

.execution-chat-rail-new svg {
  width: 14px;
  height: 14px;
}

.execution-chat-rail-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.execution-chat-rail-empty {
  margin: 0;
  padding: var(--sp-8);
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
}

.execution-chat-rail-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: var(--sp-6) var(--sp-8);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}

.execution-chat-rail-option:hover {
  background: var(--bg-hover);
}

.execution-chat-rail-option.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.execution-chat-rail-option-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-bright);
}

.execution-chat-rail-option-kind {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.execution-chat-collapse-icon { display: none; }
.execution-chat-panel.is-expanded .execution-chat-expand-icon { display: none; }
.execution-chat-panel.is-expanded .execution-chat-collapse-icon { display: block; }

.execution-chat-rail-toggle[hidden] { display: none; }

.execution-chat-phone[hidden] { display: none; }

.execution-chat-phone[aria-pressed="true"] {
  background: rgba(120, 200, 240, 0.18);
  color: rgb(160, 220, 250);
  border-color: rgba(120, 200, 240, 0.55);
}

.execution-chat-phone:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.execution-chat-ghost[aria-pressed="true"] {
  background: rgba(180, 160, 230, 0.18);
  color: rgb(200, 180, 240);
  border-color: rgba(180, 160, 230, 0.55);
}

.execution-chat-panel.is-ephemeral-locked .execution-chat-ghost,
.execution-chat-ghost:disabled {
  background: rgba(180, 160, 230, 0.22);
  color: rgb(210, 190, 245);
  border-color: rgba(180, 160, 230, 0.7);
  cursor: not-allowed;
  opacity: 1;
}

.execution-chat-panel.is-ephemeral-locked .execution-chat-ghost:hover,
.execution-chat-ghost:disabled:hover {
  background: rgba(180, 160, 230, 0.22);
  color: rgb(210, 190, 245);
  border-color: rgba(180, 160, 230, 0.7);
}

.execution-chat-panel.is-ephemeral {
  border-color: rgba(180, 160, 230, 0.45);
  box-shadow: var(--glass-shadow), 0 0 0 1px rgba(180, 160, 230, 0.25) inset;
}

.execution-chat-panel.is-ephemeral .execution-chat-form {
  border-color: rgba(180, 160, 230, 0.45);
}

.execution-chat-panel.is-ephemeral .execution-chat-input::placeholder {
  color: rgba(200, 180, 240, 0.7);
}

.execution-chat-panel.is-ephemeral .execution-chat-send {
  background: rgba(180, 160, 230, 0.18);
  border-color: rgba(180, 160, 230, 0.55);
  color: rgb(200, 180, 240);
}

.execution-chat-panel.is-ephemeral .execution-chat-send:hover {
  background: rgba(180, 160, 230, 0.28);
  box-shadow: 0 0 18px rgba(180, 160, 230, 0.35);
}

.execution-chat-thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-16) var(--sp-20);
  display: flex;
  flex-direction: column;
  gap: var(--sp-10);
}

.execution-chat-empty {
  margin: auto 0;
  padding: var(--sp-24) var(--sp-16);
  text-align: center;
}

.execution-chat-empty p,
.execution-chat-empty span {
  margin: 0;
  color: var(--text-tertiary);
  font-size: 13px;
}

.execution-chat-empty span {
  display: block;
  margin-top: var(--sp-4);
  font-size: 12px;
  line-height: 1.4;
}

/* ── Chat messages ── */
.execution-chat-message {
  max-width: 85%;
  border-radius: var(--r-lg);
  padding: var(--sp-10) var(--sp-12);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  border: 1px solid var(--border-subtle);
  background: var(--bg-hover);
  backdrop-filter: blur(8px);
}

.execution-chat-message-user {
  align-self: flex-end;
  background: var(--accent-softer);
  border-color: rgba(132, 255, 170, 0.10);
  border-radius: var(--r-lg) var(--r-lg) var(--sp-4) var(--r-lg);
}

.execution-chat-message-assistant {
  align-self: flex-start;
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) var(--sp-4);
}

.execution-chat-message-tool {
  align-self: flex-start;
  max-width: 100%;
  background: rgba(100, 200, 230, 0.05);
  border-color: rgba(100, 200, 230, 0.08);
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) var(--sp-4);
}

.execution-chat-role {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.execution-chat-message p {
  margin: 0;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Chat form ── */
.execution-chat-form {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin: 0 var(--sp-12) var(--sp-10);
  padding: 5px 5px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  backdrop-filter: blur(8px);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.execution-chat-form:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-softer);
}

.execution-chat-form .execution-chat-input {
  flex: 1 1 auto;
  min-width: 0;
}

.execution-chat-attach,
.execution-chat-mic,
.execution-chat-voice-mode {
  width: 32px;
  height: 32px;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.execution-chat-attach[hidden],
.execution-chat-mic[hidden],
.execution-chat-voice-mode[hidden] { display: none; }

.execution-chat-attach svg,
.execution-chat-mic svg,
.execution-chat-voice-mode svg {
  width: 16px;
  height: 16px;
}

.execution-chat-attach:hover,
.execution-chat-mic:hover,
.execution-chat-voice-mode:hover {
  color: var(--text-bright);
  background: var(--bg-hover);
  border-color: var(--border-subtle);
}

.execution-chat-mic.is-recording {
  background: rgba(255, 90, 90, 0.18);
  border-color: rgba(255, 90, 90, 0.6);
  color: rgb(255, 130, 130);
  animation: chat-mic-pulse 1.4s ease-in-out infinite;
}

.execution-chat-voice-mode.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  animation: chat-voice-mode-pulse 1.6s ease-in-out infinite;
}

@keyframes chat-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 90, 90, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(255, 90, 90, 0); }
}

@keyframes chat-voice-mode-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

.execution-chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-6);
  padding: 0 var(--sp-16);
  margin-top: var(--sp-8);
}

.execution-chat-attachments[hidden] { display: none; }

.execution-chat-attachment {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-6);
  padding: var(--sp-4) var(--sp-8);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-hover);
  font-size: 12px;
  color: var(--text-primary);
  max-width: 220px;
}

.execution-chat-attachment-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.execution-chat-attachment-remove {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

.execution-chat-attachment-remove:hover {
  background: var(--bg-surface);
  color: var(--text-bright);
}

.execution-chat-input {
  height: 32px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-primary);
  padding: 0 var(--sp-8);
  font: inherit;
  font-size: 14px;
  line-height: 32px;
  transition: none;
}

.execution-chat-input::placeholder {
  color: var(--text-tertiary);
  font-size: 14px;
}

.execution-chat-input:focus {
  outline: none;
  box-shadow: none;
}

.execution-chat-send {
  width: 32px;
  height: 32px;
  border-radius: 14px;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.execution-chat-send svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.execution-chat-send:hover {
  background: rgba(132, 255, 170, 0.18);
  box-shadow: var(--accent-glow);
  transform: scale(1.05);
}

.execution-chat-send:active {
  transform: scale(0.95);
}

/* ── Chat inline selectors (Tools / Skills / Projet) ── */
.execution-chat-selectors {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-12);
  margin: 0 var(--sp-12) var(--sp-10);
  padding: 0 var(--sp-6);
}

.execution-chat-selector-wrap {
  position: relative;
}

.execution-chat-selector {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-4);
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text-tertiary);
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.execution-chat-selector:hover {
  color: var(--text-bright);
}

.execution-chat-selector.has-selection {
  color: var(--text-primary);
}

.execution-chat-selector.is-empty .execution-chat-selector-label {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  opacity: 0.55;
}

.execution-chat-selector-chevron {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.execution-chat-selector[aria-expanded="true"] .execution-chat-selector-chevron {
  transform: rotate(180deg);
}

.execution-chat-selector-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  padding: var(--sp-4);
  z-index: 20;
}

.execution-chat-selector-menu[hidden] {
  display: none;
}

.execution-chat-selector-option {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  width: 100%;
  padding: var(--sp-4) var(--sp-8);
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.execution-chat-selector-option:hover {
  background: var(--bg-hover);
}

.execution-chat-selector-option.is-selected {
  color: var(--accent);
}

.execution-chat-selector-option-check {
  display: inline-flex;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--accent);
}

.execution-chat-selector-option-check[data-empty="true"] {
  visibility: hidden;
}

.execution-chat-selector-empty {
  padding: var(--sp-4) var(--sp-8);
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ══════════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════════ */
@keyframes edge-pulse {
  0%, 100% { opacity: 0.10; }
  50%      { opacity: 0.18; }
}

@keyframes node-in {
  from { opacity: 0; transform: scale(0.96) rotate(var(--node-tilt, 0deg)); }
  to   { opacity: 1; transform: scale(1) rotate(var(--node-tilt, 0deg)); }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1440px) {
  .node-title { font-size: 18px; }
  .next-panel { width: 320px; }
  .next-panel h2 { font-size: 32px; }
}

@media (max-width: 1200px) {
  .graph-node { width: 272px; }
}

@media (max-width: 940px) {
  .sync-indicator {
    top: 14px;
    right: 170px;
  }

  .mode-tabs {
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
  }

  .view-controls {
    top: var(--sp-16);
    right: var(--sp-16);
  }

  .detail-agent-header {
    top: var(--sp-16);
    left: calc(var(--sp-16) + 52px + var(--sp-12));
    gap: var(--sp-12);
    max-width: min(380px, calc(100vw - 100px));
  }

  .detail-agent-topline { gap: var(--sp-10); }
  .detail-agent-title { font-size: 26px; }

  .detail-agent-handle { font-size: 17px; }

  .detail-agent-role {
    padding: var(--sp-6) var(--sp-10);
    font-size: 11px;
  }

  .graph-node { width: 238px; }
  .node-title { font-size: 16px; }

  .progress-card { width: 292px; }
  .progress-head p strong { font-size: 16px; }

  .execution-chat-panel {
    left: var(--sp-16);
    top: calc(var(--sp-16) + 52px + var(--sp-12));
    bottom: var(--sp-16);
    width: min(400px, calc(100vw - 34px));
  }

  .projects-modal {
    right: var(--sp-16);
    top: calc(var(--sp-16) + 52px + var(--sp-12));
    bottom: var(--sp-16);
    width: min(400px, calc(100vw - 34px));
  }
}

@media (max-width: 760px) {
  .quick-create {
    top: var(--sp-16);
    left: var(--sp-16);
    right: var(--sp-16);
    max-width: calc(100vw - 32px);
    flex-direction: row;
    justify-content: flex-start;
  }

  .workflow-list {
    flex-direction: row;
    max-width: calc(100vw - 100px);
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0;
  }

  .mode-tabs { display: none; }

  .view-controls {
    top: var(--sp-16);
    right: var(--sp-16);
  }

  .detail-agent-header {
    top: calc(var(--sp-12) + 60px + var(--sp-12));
    left: var(--sp-12);
    right: var(--sp-12);
    gap: var(--sp-12);
    max-width: none;
  }

  .detail-agent-title { font-size: 27px; }

  .execution-chat-panel,
  .projects-modal {
    left: var(--sp-12);
    right: var(--sp-12);
    top: 70px;
    bottom: 82px;
    width: auto;
  }

  .execution-chat-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .detail-agent-handle { font-size: 17px; }
  .detail-agent-role { margin-top: 2px; }

  .bottom-actions {
    left: var(--sp-12);
    right: var(--sp-12);
    transform: none;
    width: auto;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .progress-card {
    left: var(--sp-12);
    right: var(--sp-12);
    width: auto;
    bottom: 136px;
  }

  .sync-indicator {
    top: 58px;
    right: var(--sp-12);
    font-size: 10px;
    padding: var(--sp-6) var(--sp-10);
  }
}

/* ══════════════════════════════════════════════════════════════
   PROJECTS — toggle button + modal
   ══════════════════════════════════════════════════════════════ */
.projects-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  height: 52px;
  padding: 0 var(--sp-16);
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.projects-toggle:hover {
  color: var(--text-bright);
  border-color: var(--glass-border-hover);
}

.projects-toggle-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-sm);
  background: var(--bg-active);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.projects-toggle-count.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.projects-modal {
  position: absolute;
  right: var(--sp-24);
  top: calc(var(--sp-24) + 52px + var(--sp-16));
  bottom: var(--sp-20);
  z-index: 6;
  width: min(420px, calc(100vw - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-xl);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}

.projects-modal[hidden] {
  display: none;
}

.side-panel-head {
  padding: var(--sp-16) var(--sp-20) var(--sp-12);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-12);
}

.side-panel-head-copy {
  min-width: 0;
}

.side-panel-head .model-editor-eyebrow {
  margin: 0 0 var(--sp-4);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.side-panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 0.01em;
}

.side-panel-head-action {
  appearance: none;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--text-bright);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.side-panel-head-action-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.side-panel-head-action:hover {
  background: var(--accent);
  color: var(--bg-base, #0b0f14);
  border-color: var(--accent);
}

.side-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-16) var(--sp-20);
  display: flex;
  flex-direction: column;
  gap: var(--sp-12);
}

.projects-modal-list {
  display: grid;
  gap: 8px;
}

.projects-modal-empty {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
  border: 1px dashed var(--border);
  border-radius: 14px;
}

.projects-modal-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.projects-modal-row:hover {
  border-color: var(--accent-border);
  background: var(--bg-active);
}

.projects-modal-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.projects-modal-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.projects-modal-text span {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.projects-modal-delete {
  appearance: none;
  border: 1px solid rgba(255, 100, 100, 0.25);
  background: rgba(255, 100, 100, 0.08);
  color: #ffb3b3;
  border-radius: 10px;
  width: 28px;
  height: 28px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.projects-modal-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.projects-modal-edit {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: 10px;
  width: 28px;
  height: 28px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.projects-modal-edit:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.projects-modal-status {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  min-height: 14px;
}

.project-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.project-editor-modal[hidden] {
  display: none;
}

.project-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 12, 0.65);
  backdrop-filter: blur(8px);
}

.project-editor-dialog {
  position: relative;
  z-index: 1;
  top: auto;
  left: auto;
  transform: none;
  width: min(880px, calc(100vw - 64px));
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: var(--r-2xl);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.6), var(--glass-shadow);
}

.project-editor-dialog .model-editor-head {
  padding: 28px 32px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.project-editor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 12px 24px 0;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.12);
}

.project-editor-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  margin-bottom: -1px;
}

.project-editor-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.project-editor-tab.is-active {
  color: var(--text-bright);
  border-bottom-color: var(--accent);
  background: var(--bg-hover);
}

.project-editor-tab[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.project-editor-tab .project-editor-tab-count {
  margin-left: 6px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--bg-active);
  color: var(--text-tertiary);
  font-weight: 700;
}

.project-editor-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 32px;
}

.project-editor-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 32px 20px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.12);
}

.project-editor-status {
  margin: 0;
  padding: 0 32px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  min-height: 14px;
}

.project-editor-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.project-editor-loading {
  padding: 60px 32px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.project-editor-locked {
  padding: 32px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.12);
}

.project-editor-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-editor-field-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.project-editor-input,
.project-editor-textarea,
.project-editor-select {
  font: inherit;
  font-size: 14px;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.project-editor-input::placeholder,
.project-editor-textarea::placeholder {
  color: var(--text-tertiary);
}

.project-editor-input:focus,
.project-editor-textarea:focus,
.project-editor-select:focus {
  outline: none;
  border-color: var(--accent-border);
  background: var(--bg-active);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.project-editor-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.project-editor-section {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-surface);
}

.project-editor-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-editor-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0;
}

.project-editor-section-help {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0;
  line-height: 1.5;
}

.project-editor-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-editor-empty {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.project-editor-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.project-editor-item-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.project-editor-item-text strong {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

.project-editor-item-text span {
  font-size: 12px;
  color: var(--text-secondary);
}

.project-editor-item-text em {
  font-size: 12px;
  color: var(--text-tertiary);
  font-style: normal;
  line-height: 1.5;
  white-space: pre-wrap;
}

.project-editor-item-remove {
  appearance: none;
  border: 1px solid rgba(255, 100, 100, 0.25);
  background: rgba(255, 100, 100, 0.08);
  color: #ffb3b3;
  border-radius: 10px;
  width: 30px;
  height: 30px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.project-editor-item-remove:hover {
  background: rgba(255, 100, 100, 0.18);
  border-color: rgba(255, 100, 100, 0.45);
}

.project-editor-add {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.project-editor-add-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.project-editor-add-grid-3 {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 10px;
}

.project-editor-add input,
.project-editor-add select,
.project-editor-add textarea {
  font: inherit;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.project-editor-add input::placeholder,
.project-editor-add textarea::placeholder {
  color: var(--text-tertiary);
}

.project-editor-add input:focus,
.project-editor-add select:focus,
.project-editor-add textarea:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.project-editor-add-button {
  align-self: flex-end;
  appearance: none;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--text-bright);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.project-editor-add-button:hover {
  background: var(--accent);
  color: var(--bg-base, #0b0f14);
  border-color: var(--accent);
}

