/* ============================================================
   Canvas shell — top bar, rail, viewport, zoom, drawers
   ============================================================ */

.canvas-page {
  position: fixed;
  inset: 0;
  background: var(--bg-canvas);
  overflow: hidden;
  user-select: none;
}

/* ---------- top bar ---------- */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(11,11,12,0.88) 0%, rgba(11,11,12,0.55) 55%, rgba(11,11,12,0) 100%);
}
.topbar > * { pointer-events: auto; }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .brand { cursor: pointer; }
.topbar .brand:hover .brand-name { color: #fff; }
.topbar-divider { width: 1px; height: 16px; background: var(--line-2); }
.project-title {
  font-size: 12.5px;
  color: #c9c9ce;
  padding: 5px 7px;
  border-radius: 6px;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  transition: background 0.15s;
}
.project-title:hover { background: rgba(255,255,255,0.06); }
.project-title[contenteditable="true"] {
  background: #171718;
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: #fff;
}
.save-state {
  font-size: 10.5px;
  color: var(--text-4);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 2px;
  opacity: 0;
  transition: opacity 0.2s;
}
.save-state.show { opacity: 1; }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.credit-chip.compact { height: 30px; padding: 0 9px; gap: 6px; font-size: 11.5px; }
.credit-chip.compact .heart { width: 13px; height: 13px; }
.credit-chip.compact .bolt { color: #d8d8dc; }

/* ---------- left rail ---------- */
.rail {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: var(--rail-w);
  padding: 5px;
  border-radius: 13px;
  background: #171718;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07), 0 16px 40px rgba(0,0,0,0.45);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.rail-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9c9ca3;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.rail-btn:hover { background: #26262a; color: #f0f0f2; }
.rail-btn.is-active { background: #2a2a2e; color: #fff; }
.rail-btn.primary {
  background: #f2f2f3;
  color: #141415;
  margin-bottom: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.rail-btn.primary:hover { background: #fff; }
.rail-sep { width: 22px; height: 1px; background: rgba(255,255,255,0.08); margin: 3px 0; }
.rail-btn .tooltip-anchor { position: absolute; }

/* ---------- viewport ---------- */
.stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: default;
  background-color: var(--bg-canvas);
  background-image: radial-gradient(circle at center, rgba(255,255,255,0.085) 1px, transparent 1.3px);
  background-repeat: repeat;
  touch-action: none;
}
.stage.is-panning { cursor: grabbing; }
.stage.is-hand { cursor: grab; }
.stage.is-marquee { cursor: crosshair; }

.world {
  position: absolute;
  left: 0; top: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.world-inner { position: absolute; left: 0; top: 0; }

.edges-svg {
  position: absolute;
  left: 0; top: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: 2;
}
.edges-svg .edge-hit {
  pointer-events: stroke;
  cursor: pointer;
  stroke: transparent;
  stroke-width: 14;
  fill: none;
}
.edge-base { fill: none; stroke: rgba(214, 224, 240, 0.34); stroke-width: 1.15; }
.edge-glow { fill: none; stroke-width: 3.2; opacity: 0.35; filter: blur(2.4px); }
.edge.is-selected .edge-base { stroke: rgba(140, 190, 255, 0.95); stroke-width: 1.6; }
.edge.is-connected .edge-base { stroke: rgba(230, 238, 250, 0.55); }

.groups-layer {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  z-index: 1;
}
.nodes-layer {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  z-index: 3;
}

/* ---------- group frame ---------- */
.group-frame {
  position: absolute;
  border-radius: 14px;
  background: rgba(255,255,255,0.018);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07);
  z-index: 1;
}
.group-frame .group-title {
  position: absolute;
  top: -24px;
  left: 4px;
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.group-rename {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: #6b6b73;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s;
}
.group-frame:hover .group-rename, .group-frame.is-selected .group-rename { opacity: 1; }
.group-rename:hover { color: #e6e6ea; background: rgba(255,255,255,0.1); }
.group-title span[contenteditable="true"] {
  outline: none;
  min-width: 40px;
  padding: 1px 4px;
  border-radius: 4px;
  background: #0f0f10;
  box-shadow: inset 0 0 0 1px rgba(110,168,255,0.65);
  color: #fff;
}
.group-frame.is-selected { box-shadow: inset 0 0 0 1px rgba(110,168,255,0.55); }

/* ---------- marquee ---------- */
.marquee {
  position: absolute;
  border: 1px solid rgba(120, 175, 255, 0.8);
  background: rgba(90, 150, 255, 0.08);
  border-radius: 2px;
  z-index: 30;
  pointer-events: none;
}

/* ---------- zoom bar ---------- */
.zoombar {
  position: absolute;
  left: 14px;
  bottom: 14px;
  height: 36px;
  padding: 3px 7px;
  display: flex;
  align-items: center;
  gap: 2px;
  background: #171718;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07), 0 10px 28px rgba(0,0,0,0.4);
  z-index: 60;
}
.zoombar .icon-btn { width: 28px; height: 28px; color: #a4a4ab; }
.zoombar .icon-btn:hover { background: #26262a; }
.zoombar .sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 4px; }
.zoom-value {
  min-width: 42px;
  height: 28px;
  padding: 0 4px;
  font-size: 11.5px;
  color: #d6d6da;
  font-variant-numeric: tabular-nums;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.zoom-value:hover { background: #26262a; }
.avatar-stack { display: flex; align-items: center; padding: 0 4px 0 2px; }
.avatar-stack .avatar {
  width: 20px; height: 20px; border-radius: 50%;
  box-shadow: 0 0 0 2px #171718;
  margin-left: -5px;
}
.avatar-stack .avatar:first-child { margin-left: 0; }

.center-btn {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #171718;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.13), 0 6px 16px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6e6e76;
  z-index: 60;
}
.center-btn:hover { color: #fff; background: #202022; }

/* ---------- node context toolbar (fixed, unscaled) ---------- */
.node-toolbar {
  position: fixed;
  z-index: 85;
  height: 40px;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 1px;
  background: #1a1a1c;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(255,255,255,0.08);
  backdrop-filter: blur(16px);
  animation: toolbar-in 0.14s var(--ease);
  white-space: nowrap;
}
@keyframes toolbar-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.toolbar-btn {
  height: 30px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  font-size: 11.5px;
  color: #d2d2d6;
  transition: background 0.13s, color 0.13s;
}
.toolbar-btn .ic { color: #9a9aa2; }
.toolbar-btn:hover { background: #2a2a2d; color: #fff; }
.toolbar-btn:hover .ic { color: #e6e6ea; }
.toolbar-sep { width: 1px; height: 18px; background: rgba(255,255,255,0.1); margin: 0 4px; }

/* ---------- drawers ---------- */
.drawer {
  position: absolute;
  top: 66px;
  right: 14px;
  bottom: 14px;
  width: 322px;
  background: #171718;
  border-radius: 13px;
  box-shadow: var(--shadow-panel), inset 0 0 0 1px rgba(255,255,255,0.07);
  z-index: 80;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: drawer-in 0.2s var(--ease);
}
@keyframes drawer-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.drawer-head {
  height: 46px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 14px;
  border-bottom: 1px solid var(--line);
}
.drawer-title { font-size: 12.5px; font-weight: 600; }
.drawer-head .icon-btn { margin-left: auto; width: 28px; height: 28px; }
.drawer-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.drawer-tab {
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-2);
}
.drawer-tab.is-active { background: #2a2a2d; color: #fff; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px; }
.asset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.asset-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 7px;
  overflow: hidden;
  background: #101011;
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
}
.asset-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-tile .cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 14px 7px 5px;
  font-size: 9.5px;
  color: #d8d8dc;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.asset-tile:hover { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.28); }
.empty-hint {
  padding: 28px 14px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-3);
}

.history-item {
  padding: 9px 8px;
  border-radius: 7px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  cursor: default;
}
.history-item:hover { background: rgba(255,255,255,0.035); }
.history-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4d8dff; margin-top: 5px; flex: none;
}
.history-dot.gray { background: #57575e; }
.history-title { font-size: 11.5px; color: #d6d6da; line-height: 1.4; }
.history-time { font-size: 10px; color: var(--text-4); margin-top: 3px; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(6, 6, 7, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.16s var(--ease);
}
.lightbox img, .lightbox video {
  max-width: 88vw;
  max-height: 82vh;
  border-radius: 4px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.7);
}
.lightbox-close {
  position: absolute;
  top: 18px; right: 18px;
  width: 34px; height: 34px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: #ddd;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover { background: rgba(255,255,255,0.16); }
.lightbox-caption {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  font-size: 11.5px;
  color: #9b9ba2;
}

/* ---------- connecting hint ---------- */
.connect-hint {
  position: fixed;
  z-index: 90;
  padding: 6px 9px;
  font-size: 11px;
  color: #dbe6f7;
  background: rgba(23, 34, 50, 0.92);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(120,170,255,0.28);
  pointer-events: none;
}


/* ---------- empty canvas state ---------- */
.canvas-empty {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 42px;
  pointer-events: none;
}
.canvas-empty .hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #8f8f97;
  letter-spacing: 0.01em;
}
.canvas-empty .hint .ic { color: #b0b0b8; }
.empty-templates {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}
.empty-tpl {
  position: relative;
  width: 178px;
  height: 58px;
  border-radius: 7px;
  overflow: hidden;
  background: #171718;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 14px 30px rgba(0,0,0,0.3);
  text-align: left;
  padding: 0 12px;
  display: flex;
  align-items: center;
  font-size: 11.5px;
  color: #ececef;
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.empty-tpl:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2), 0 18px 36px rgba(0,0,0,0.4); }
.empty-tpl .bg {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 52%;
  background-size: cover;
  background-position: center;
  opacity: 0.55;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 55%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 55%);
}
.empty-tpl .tint {
  position: absolute;
  inset: 0;
  opacity: 0.42;
}
.empty-tpl span { position: relative; z-index: 2; }
.empty-tpl.t1 .tint { background: linear-gradient(90deg, rgba(29,42,66,0.9), rgba(29,42,66,0.05)); }
.empty-tpl.t2 .tint { background: linear-gradient(90deg, rgba(72,26,26,0.9), rgba(72,26,26,0.05)); }
.empty-tpl.t3 .tint { background: linear-gradient(90deg, rgba(56,56,26,0.9), rgba(56,56,26,0.05)); }
.empty-tpl.t4 .tint { background: linear-gradient(90deg, rgba(24,58,40,0.9), rgba(24,58,40,0.05)); }

/* ---------- multi selection & snapping ---------- */
.multi-toolbar { gap: 0; padding: 4px 6px 4px 8px; z-index: 86; }
.multi-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-right: 4px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #141415;
  background: #e9e9ec;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.toolbar-btn.icon-only { padding: 0 7px; }
.guides-layer {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  z-index: 40;
  pointer-events: none;
}
.snap-guide {
  position: absolute;
  background: rgba(110, 168, 255, 0.92);
  box-shadow: 0 0 6px rgba(110, 168, 255, 0.5);
}
.snap-guide.v { top: -6000px; width: 1px; height: 12000px; }
.snap-guide.h { left: -6000px; height: 1px; width: 12000px; }

/* ---------- generation history ---------- */
.history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: 62vh;
  overflow-y: auto;
}
.history-card {
  text-align: left;
  border-radius: 7px;
  overflow: hidden;
  background: #111112;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.history-card:hover { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.28); }
.hc-thumb { position: relative; aspect-ratio: 16 / 9; background: #0d0d0e; }
.hc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hc-time {
  position: absolute;
  right: 6px; bottom: 6px;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 9px;
  color: #e8e8ec;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
}
.hc-prompt {
  padding: 7px 8px 8px;
  font-size: 10.5px;
  line-height: 1.5;
  color: #9b9ba3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ---------- region editor ---------- */
.re-wrap { padding: 2px 0 4px; }
.re-canvas {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #0c0c0d;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}
.re-canvas > img { display: block; width: 100%; height: auto; pointer-events: none; }
.re-layer { position: absolute; inset: 0; }
.re-box {
  position: absolute;
  border: 1.5px solid #8fc0ff;
  background: rgba(90,150,255,0.12);
  box-shadow: 0 0 0 9999px rgba(5,5,6,0.35);
}
.re-box span {
  position: absolute;
  left: -1.5px; top: -19px;
  height: 17px;
  padding: 0 6px;
  border-radius: 4px 4px 4px 0;
  background: #8fc0ff;
  color: #0b0b0c;
  font-size: 9.5px;
  line-height: 17px;
  font-weight: 600;
}
.re-existing {
  position: absolute;
  border: 1px dashed rgba(255,196,120,0.85);
  background: rgba(255,180,90,0.08);
}
.re-tip {
  margin-top: 10px;
  font-size: 11.5px;
  line-height: 1.7;
  color: #7f7f88;
}


/* ---------- library drawer ---------- */
.drawer-sub {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.folder-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.folder-chip {
  height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 10.5px;
  color: #a8a8b0;
  background: #202023;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-chip:hover { color: #fff; }
.folder-chip.is-active { background: #e9e9ec; color: #141415; font-weight: 600; }
.folder-add {
  width: 24px; height: 24px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8b8b93;
}
.folder-add:hover { background: #26262a; color: #fff; }
.sub-row { display: flex; align-items: center; gap: 8px; }
.sub-hint { font-size: 9.5px; color: #6e6e76; line-height: 1.5; flex: 1; }
.sub-row .btn { height: 24px; padding: 0 8px; font-size: 10px; }

.asset-tile .auto-badge {
  position: absolute;
  left: 5px; top: 5px;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 8px;
  color: #dfe9fb;
  background: rgba(20,32,52,0.7);
  box-shadow: inset 0 0 0 1px rgba(110,168,255,0.25);
}
.asset-tile[draggable="true"] { cursor: grab; }
.asset-tile[draggable="true"]:active { cursor: grabbing; }

.char-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.char-card {
  position: relative;
  border-radius: 7px;
  overflow: hidden;
  background: #111112;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
  cursor: pointer;
}
.char-card:hover { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.26); }
.char-cover { aspect-ratio: 3 / 4; background: #0d0d0e; }
.char-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.char-name {
  padding: 6px 7px;
  font-size: 10.5px;
  color: #cfcfd4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.char-del {
  position: absolute;
  top: 5px; right: 5px;
  width: 18px; height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ddd;
  background: rgba(0,0,0,0.5);
  opacity: 0;
}
.char-card:hover .char-del { opacity: 1; }
.char-del:hover { background: rgba(140,30,30,0.8); }

.node.is-drop-target .media-frame,
.node.is-drop-target .media-empty,
.node.is-drop-target .audio-card,
.node.is-drop-target .text-card {
  box-shadow: 0 0 0 2px rgba(110,168,255,0.95), 0 18px 40px rgba(0,0,0,0.45) !important;
}


/* ---------- typography panel ---------- */
.typo-preview {
  min-height: 96px;
  padding: 16px;
  margin-bottom: 14px;
  border-radius: 7px;
  background: #111112;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
  white-space: pre-wrap;
  overflow: hidden;
  max-height: 180px;
}
.typo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.typo-grid .field { margin-bottom: 10px; }
.typo-align { display: flex; align-items: center; gap: 5px; margin-top: 4px; }
.typo-align .filter-chip { height: 25px; font-size: 10.5px; }
.typo-check { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: #9a9aa2; }
.typo-check input { accent-color: #6ea8ff; }


/* ---------- node search palette ---------- */
.palette-input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  margin-bottom: 8px;
  border-radius: 7px;
  background: #0f0f10;
  border: 1px solid rgba(255,255,255,0.1);
  outline: none;
  font-size: 12px;
  color: #eee;
}
.palette-input:focus { border-color: rgba(110,168,255,0.6); }
.palette-list { max-height: 52vh; overflow-y: auto; }
.palette-item {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b8b8c0;
  text-align: left;
}
.palette-item:hover { background: #26262a; color: #fff; }
.palette-item .ic { color: #7f7f87; }
.palette-item .pi-name { font-size: 11.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .pi-type { font-size: 9.5px; color: #6e6e76; }

/* ---------- rail badge / tasks ---------- */
.rail-btn .rail-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 12px;
  height: 12px;
  padding: 0 3px;
  border-radius: 6px;
  background: #6ea8ff;
  color: #0c0c0d;
  font-size: 8px;
  line-height: 12px;
  text-align: center;
  font-weight: 700;
  box-shadow: 0 0 0 2px #171718;
}
.rail-btn .rail-badge.is-failed { background: #ff6b6b; color: #fff; }

.task-list { display: flex; flex-direction: column; gap: 2px; }
.task-row {
  display: flex;
  gap: 9px;
  padding: 9px 7px;
  border-radius: 7px;
  align-items: flex-start;
}
.task-row:hover { background: rgba(255,255,255,0.035); }
.task-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  flex: none;
  background: #5b5b63;
}
.task-dot.running { background: #6ea8ff; box-shadow: 0 0 0 3px rgba(110,168,255,0.14); }
.task-dot.done { background: #57d39b; }
.task-dot.failed { background: #ff6b6b; }
.task-dot.cancelled { background: #6b6b73; }
.task-main { flex: 1; min-width: 0; }
.task-title {
  font-size: 11.5px;
  color: #dcdce0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.task-kind {
  font-size: 8px;
  padding: 1px 4px;
  border-radius: 3px;
  color: #9a9aa2;
  background: #232326;
  text-transform: uppercase;
}
.task-sub {
  display: flex;
  gap: 8px;
  margin-top: 3px;
  font-size: 9.5px;
  color: #77777f;
}
.task-bar {
  height: 2px;
  margin-top: 6px;
  border-radius: 2px;
  background: #262629;
  overflow: hidden;
}
.task-bar i { display: block; height: 100%; background: #6ea8ff; transition: width 0.2s; }
.task-actions { display: flex; gap: 2px; margin-top: 1px; }
.task-actions button {
  width: 22px; height: 22px;
  border-radius: 4px;
  color: #8b8b93;
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-actions button:hover { background: #2a2a2d; color: #fff; }


.node.is-hidden { display: none !important; }
.project-menu-btn {
  width: 20px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px;
  color: #7e7e86;
}
.project-menu-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.stage.bg-plain { background-image: none !important; }
.stage.bg-grid {
  background-image:
    linear-gradient(rgba(255,255,255,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.055) 1px, transparent 1px) !important;
}

/* ---------- reference picker ---------- */
.ref-pick-hint { font-size: 11px; line-height: 1.6; color: #7c7c84; margin-bottom: 10px; }
.ref-pick-list { max-height: 56vh; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.rp-group { font-size: 9.5px; color: #66666e; margin: 10px 0 3px; letter-spacing: 0.04em; }
.rp-group:first-child { margin-top: 0; }
.ref-pick {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border-radius: 8px;
  text-align: left;
  background: #1a1a1d;
  transition: background 0.12s;
}
.ref-pick:hover:not(.is-disabled) { background: #232327; }
.ref-pick.is-disabled { opacity: 0.34; cursor: not-allowed; }
.ref-pick.is-added { box-shadow: inset 0 0 0 1px rgba(110,168,255,0.42); background: rgba(110,168,255,0.07); }
.rp-thumb {
  width: 34px; height: 34px;
  border-radius: 6px;
  overflow: hidden;
  background: #101012;
  display: flex; align-items: center; justify-content: center;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
.rp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rp-ico { font-size: 11px; color: #9dc2ff; }
.rp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rp-main b { font-size: 12px; color: #e6e6ea; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-main i { font-style: normal; font-size: 9.5px; color: #6f6f77; }
.rp-state { font-size: 9.5px; color: #6f6f77; flex: none; }
.ref-pick.is-added .rp-state { color: #8fb5e8; }
.ref-pick-empty { padding: 18px 0; text-align: center; font-size: 11px; color: #6f6f77; }

/* ---------- 节点评论 ---------- */
.comment-panel { display: flex; flex-direction: column; gap: 12px; }
.comment-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.comment-item { display: flex; gap: 9px; }
.comment-avatar {
  width: 24px; height: 24px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #cfd8e6;
  background: rgba(110,168,255,0.16);
  flex: none;
}
.comment-main { flex: 1; min-width: 0; }
.comment-meta { display: flex; align-items: baseline; gap: 8px; font-size: 9.5px; color: #6f6f77; }
.comment-meta b { font-size: 11px; color: #dcdce2; font-weight: 500; }
.comment-resolved { color: #7fd1a0; }
.comment-text { font-size: 11.5px; line-height: 1.7; color: #b9b9c1; margin: 3px 0 4px; word-break: break-word; }
.comment-acts { display: flex; gap: 10px; }
.comment-acts button { font-size: 9.5px; color: #7f7f87; }
.comment-acts button:hover { color: #dcdce2; }
.comment-acts button.danger:hover { color: #ff8b8b; }
.comment-item.is-resolved .comment-text { color: #7f7f87; text-decoration: line-through; }
.comment-empty { padding: 20px 0; text-align: center; font-size: 11px; color: #6f6f77; }
.comment-new textarea {
  width: 100%;
  min-height: 58px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #101011;
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 11.5px;
  line-height: 1.6;
  color: #e6e6ea;
  resize: vertical;
  outline: none;
}
.comment-new textarea:focus { border-color: rgba(110,168,255,0.55); }
.comment-new-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; }
.comment-hint { font-size: 9px; color: #5d5d65; }
