/* ═══════════════════════════════════════════════════════════════════════════
   Phase 5 — 제어 모드 + 규칙 빌더
   mockup css/07-control-mode.css + css/08-rule-builder.css → React 포팅
   ★ --v5-* / --ctrl-* 변수 사용, 즉흥 hex 금지
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 제어 모드 변수 ── */
:root {
  --ctrl-cyan: #00cec9;
  --ctrl-cyan-glow: rgba(var(--v5-cyan-rgb), .3);
  --ctrl-primary: #6c5ce7;
  --ctrl-amber: #fdcb6e;
  --ctrl-pink: #fd79a8;
  --ctrl-green: #55efc4;
  --ctrl-red: #ff4757;
  --ctrl-glass: rgba(255, 255, 255, .06);
  --ctrl-glass-strong: rgba(255, 255, 255, .08);
  --ctrl-glass-border: rgba(var(--v5-cyan-rgb), .25);
}
.dark {
  --ctrl-glass: rgba(255, 255, 255, .04);
  --ctrl-glass-strong: rgba(255, 255, 255, .06);
}

/* ═══ 편집/제어 모드 캔버스 — INVYONE Design System (ui_kits/app) 포팅 ═══
   primary/cyan tint + 24px line grid + inset 2px border.
   기본 dash-canvas 의 dot grid 를 override. */
.dash-canvas.edit-mode {
  background-color: var(--v5-bg);
  background-image:
    linear-gradient(0deg, rgba(var(--v5-primary-rgb), .035), rgba(var(--v5-primary-rgb), .035));
  box-shadow: inset 0 0 0 2px rgba(var(--v5-primary-rgb), .22);
}
.dash-canvas.edit-mode::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(var(--v5-primary-rgb), .08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(var(--v5-primary-rgb), .08) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: 0;
  animation: ud-grid-fade .4s var(--v5-ease-move) both;
}

.dash-canvas.control-mode {
  background-color: var(--v5-bg);
  background-image:
    linear-gradient(0deg, rgba(var(--v5-cyan-rgb), .035), rgba(var(--v5-cyan-rgb), .035));
  box-shadow: inset 0 0 0 2px rgba(var(--v5-cyan-rgb), .22);
  overflow: auto;
}
.dash-canvas.control-mode::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(var(--v5-cyan-rgb), .08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(var(--v5-cyan-rgb), .08) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
  animation: ud-grid-fade .4s var(--v5-ease-move) both;
}

/* 다크모드에서는 tint를 조금 강하게 */
.dark .dash-canvas.edit-mode {
  background-image:
    linear-gradient(0deg, rgba(var(--v5-primary-rgb), .05), rgba(var(--v5-primary-rgb), .05));
  box-shadow: inset 0 0 0 2px rgba(var(--v5-primary-rgb), .28);
}
.dark .dash-canvas.control-mode {
  background-image:
    linear-gradient(0deg, rgba(var(--v5-cyan-rgb), .05), rgba(var(--v5-cyan-rgb), .05));
  box-shadow: inset 0 0 0 2px rgba(var(--v5-cyan-rgb), .28);
}

@keyframes ud-grid-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* 카드 축소 + 클릭 가능 */
.dash-canvas.control-mode .dash-card {
  transition: all .5s cubic-bezier(.16,1,.3,1);
  opacity: .5; z-index: 25; cursor: pointer;
}
.dash-canvas.control-mode .dash-card:hover { opacity: .8; box-shadow: 0 0 20px var(--ctrl-cyan-glow); }
.dash-canvas.control-mode .dash-card.flow-active {
  opacity: 1; border-color: var(--ctrl-cyan);
  box-shadow: 0 0 30px rgba(var(--v5-cyan-rgb),.3);
}

/* ── 제어 모드 토글 버튼 활성 ── */
.dash-btn.control-on {
  background: linear-gradient(135deg, var(--ctrl-cyan), #55efc4) !important;
  color: #06050e !important; border-color: transparent !important;
  box-shadow: 0 0 20px rgba(var(--v5-cyan-rgb),.3) !important; font-weight: 700;
}
.dash-btn.control-on:hover { box-shadow: 0 0 30px rgba(var(--v5-cyan-rgb),.45) !important; }

/* ═══ SVG 오버레이 ═══ */
.ctrl-svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 10; overflow: visible;
}

/* ── 연결선 4종 ── */
.ctrl-line { fill: none; stroke: var(--ctrl-cyan); stroke-width: 1.5; opacity: .55;
  stroke-dasharray: 6 3; animation: ctrlPulse 1.5s linear infinite; }
.ctrl-line-auto { fill: none; stroke: var(--ctrl-primary); stroke-width: 2.5; opacity: .6;
  stroke-dasharray: 6 4; animation: ctrlPulse 1.2s linear infinite; }
.ctrl-line-cond { fill: none; stroke: var(--ctrl-amber); stroke-width: 2; opacity: .55;
  stroke-dasharray: 4 4; animation: ctrlPulse 1.8s linear infinite; }
.ctrl-line-tpl { fill: none; stroke: var(--ctrl-pink); stroke-width: 2.5; opacity: .65;
  stroke-dasharray: 5 5; animation: ctrlPulse 1.4s linear infinite; }
@keyframes ctrlPulse { to { stroke-dashoffset: -18; } }

/* ★ 라이트 모드 보정 */
html:not(.dark) .ctrl-line { stroke: #00a89e; stroke-width: 2; opacity: .5; }
html:not(.dark) .ctrl-line-auto { stroke: #5b4acf; stroke-width: 3; opacity: .6; }
html:not(.dark) .ctrl-line-cond { stroke: #d4a017; stroke-width: 2.5; opacity: .55; }
html:not(.dark) .ctrl-line-tpl { stroke: #e0559e; stroke-width: 3; opacity: .6; }

/* ═══ 연결선 위 뱃지 ═══ */
.ctrl-badge {
  position: absolute; padding: .2rem .6rem; border-radius: 9px;
  background: var(--v5-surface-solid);
  border: 1px solid rgba(var(--v5-cyan-rgb),.3);
  font-size: .55rem; font-weight: 700; color: var(--ctrl-cyan);
  white-space: nowrap; z-index: 15; cursor: pointer;
  transition: all .25s var(--v5-ease-move);
  box-shadow: 0 4px 16px rgba(var(--v5-cyan-rgb),.12), 0 0 12px rgba(var(--v5-cyan-rgb),.1);
  pointer-events: auto; transform: translate(-50%, -50%);
}
.ctrl-badge:hover {
  border-color: var(--ctrl-cyan);
  box-shadow: 0 8px 24px rgba(var(--v5-cyan-rgb),.3); transform: translate(-50%,-50%) scale(1.05);
}
.ctrl-badge.auto { border-color: rgba(var(--v5-primary-rgb),.35); color: var(--ctrl-primary);
  box-shadow: 0 4px 16px rgba(var(--v5-primary-rgb),.12); }
.ctrl-badge.tpl-link { border-color: rgba(var(--v5-pink-rgb),.35); color: var(--ctrl-pink);
  box-shadow: 0 4px 16px rgba(var(--v5-pink-rgb),.12); font-size: .5rem; }

/* 조건분기 뱃지 */
.ctrl-badge.cond {
  border-color: rgba(253,203,110,.4); color: var(--v5-text, #e8e8ee);
  box-shadow: 0 6px 20px rgba(253,203,110,.15); padding: .45rem .7rem;
  min-width: 120px; text-align: left; white-space: normal; line-height: 1.4;
  border-radius: 10px; border-width: 2px;
}
.ctrl-badge.cond .cb-head {
  display: flex; align-items: center; gap: .3rem;
  font-size: .5rem; font-weight: 700; color: var(--ctrl-amber); margin-bottom: .25rem;
}
.ctrl-badge.cond .cb-icon {
  width: 16px; height: 16px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center; font-size: .6rem;
  background: rgba(253,203,110,.15); border: 1px solid rgba(253,203,110,.3);
}
.ctrl-badge.cond .cb-cond {
  font-size: .6rem; font-weight: 600; padding: .2rem .4rem;
  border-radius: 6px; background: rgba(253,203,110,.08);
  border: 1px dashed rgba(253,203,110,.25); margin-bottom: .25rem;
}
.ctrl-badge.cond .cb-paths { display: flex; gap: .5rem; font-size: .48rem; font-weight: 700; }
.ctrl-badge.cond .cb-yes { color: var(--ctrl-green); }
.ctrl-badge.cond .cb-yes::before { content: '●'; margin-right: .15rem; font-size: .4rem; }
.ctrl-badge.cond .cb-no { color: var(--v5-text-muted, #888); }
.ctrl-badge.cond .cb-no::before { content: '○'; margin-right: .15rem; font-size: .4rem; }

html:not(.dark) .ctrl-badge { background: rgba(255,255,255,.92);
  border-color: rgba(0,0,0,.15); box-shadow: 0 2px 12px rgba(0,0,0,.1); }

/* ═══ 테이블 노드 ═══ */
.tbl-node {
  position: absolute; width: 220px;
  background: var(--v5-surface-solid);
  border: 1px solid var(--ctrl-glass-border); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08), 0 0 20px rgba(var(--v5-cyan-rgb),.12);
  z-index: 20; overflow: hidden; transition: border-color .2s var(--v5-ease-move), box-shadow .2s var(--v5-ease-move);
}

/* ═══════════════════════════════════════════════════════════════════════════
   .tbl-node-compact — V3RuleNode 와 일관된 컴팩트 테이블 카드
   (Phase 1: 컬럼별 port 폐기, 좌·우 edge 단일 port. 컬럼 선택은 NodeConfigPopover dropdown)
   ═══════════════════════════════════════════════════════════════════════════ */
.tbl-node-compact {
  width: 180px;
  border: 1.5px solid rgba(var(--v5-cyan-rgb), .4);
  border-radius: 9px;
  background: var(--v5-surface-solid);
  box-shadow: 0 4px 12px -4px rgba(0,0,0,.1);
  overflow: visible;
  cursor: grab;
  user-select: none;
  transition: border-color .2s var(--v5-ease-move), box-shadow .2s var(--v5-ease-move);
}
.tbl-node-compact:hover {
  border-color: rgba(var(--v5-cyan-rgb), .7);
  box-shadow: 0 6px 18px -4px rgba(0,0,0,.14), 0 0 16px rgba(var(--v5-cyan-rgb), .15);
}
.tbl-node-compact:active { cursor: grabbing; }

.tbl-node-compact .tbl-node-stripe {
  height: 3px;
  background: var(--ctrl-cyan);
  opacity: .9;
  border-radius: 9px 9px 0 0;
}
.tbl-node-compact .tbl-node-head {
  display: flex; align-items: center; gap: 6px;
  padding: .45rem .6rem .35rem;
  background: transparent;
  border-bottom: none;
}
.tbl-node-compact .tbl-node-ico {
  width: 20px; height: 20px; border-radius: 5px;
  background: rgba(var(--v5-cyan-rgb), .14);
  color: var(--ctrl-cyan);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.tbl-node-compact .tbl-node-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tbl-node-compact .tbl-node-label {
  font-size: .73rem; font-weight: 700;
  color: var(--v5-text); letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tbl-node-compact .tbl-node-sub {
  font-family: var(--v5-font-mono); font-size: .55rem;
  color: var(--v5-text-muted); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tbl-node-compact .tbl-node-del {
  width: 16px; height: 16px;
  background: transparent; border: none; cursor: pointer;
  display: grid; place-items: center;
  color: var(--v5-text-muted);
  border-radius: 4px;
  flex-shrink: 0;
}
.tbl-node-compact .tbl-node-del:hover {
  background: rgba(255, 71, 87, .15);
  color: rgb(255, 71, 87);
}
.tbl-node-compact .tbl-node-stats {
  padding: .3rem .6rem .45rem;
  margin-top: 2px;
  display: flex; gap: 5px; justify-content: flex-start;
  font-family: var(--v5-font-mono);
  font-size: .5rem; color: var(--v5-text-muted);
  border-top: 1px dashed var(--v5-border);
}
/* 컴팩트 모드 port — V3RuleNode 와 동일한 위치/사이즈 */
.tbl-node-compact > .ctrl-io-port.port-in {
  width: 12px; height: 12px;
  left: -6px; top: 50%; transform: translateY(-50%);
  border: 2px solid var(--ctrl-cyan);
  background: var(--v5-surface-solid);
  border-radius: 50%;
  z-index: 25;
}
.tbl-node-compact > .ctrl-an-ports-out {
  position: absolute;
  right: -6px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 8px;
}
.tbl-node-compact > .ctrl-an-ports-out .ctrl-io-port {
  position: relative; right: auto; top: auto; transform: none;
  width: 12px; height: 12px;
  background: var(--ctrl-cyan); border: none; border-radius: 50%;
}
.dark .tbl-node { box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 0 20px rgba(var(--v5-cyan-rgb),.06); }
.tbl-node:hover {
  border-color: var(--ctrl-cyan);
  box-shadow: 0 12px 32px rgba(0,0,0,.12), 0 0 30px rgba(var(--v5-cyan-rgb),.18);
}

.tbl-node-head {
  display: flex; align-items: center; gap: .4rem; padding: .55rem .7rem;
  background: linear-gradient(135deg, rgba(var(--v5-cyan-rgb),.12), rgba(var(--v5-cyan-rgb),.04));
  border-bottom: 1px solid rgba(var(--v5-cyan-rgb),.15); cursor: grab;
}
.tbl-node-head:active { cursor: grabbing; }
.tbl-icon {
  width: 20px; height: 20px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; background: rgba(var(--v5-cyan-rgb),.12); flex-shrink: 0;
}
.tbl-name { flex: 1; font-size: .68rem; font-weight: 700; color: var(--v5-text, #e8e8ee); letter-spacing: -.01em; }
.tbl-badge {
  font-family: var(--v5-font-mono);
  font-size: .5rem; padding: .12rem .4rem; border-radius: 999px;
  background: var(--v5-bg-subtle, rgba(255,255,255,.04));
  color: var(--v5-text-muted, #888);
  font-weight: 600; letter-spacing: -.01em;
  border: 1px solid var(--v5-border, rgba(255,255,255,.08));
}

.tbl-node-cols { padding: .35rem 0; max-height: 220px; overflow-y: auto; overflow-x: hidden; }
.tbl-col {
  position: relative;
  display: flex; align-items: center; gap: .35rem;
  padding: .28rem .9rem;  /* 좌·우 균등 — 3px stripe + 여백 */
  font-size: .6rem; color: var(--v5-text-sec, #aaa); transition: background .1s;
}
.tbl-col:hover { background: var(--v5-surface-hover, rgba(255,255,255,.05)); color: var(--v5-text, #eee); }

.tbl-port {
  width: 8px; height: 8px; border-radius: 50%; background: var(--v5-surface, #2a2a36);
  border: 2px solid rgba(var(--v5-cyan-rgb),.35); flex-shrink: 0; cursor: crosshair; transition: all .2s;
}
.tbl-port:hover {
  background: var(--ctrl-cyan); border-color: var(--ctrl-cyan);
  box-shadow: 0 0 8px rgba(var(--v5-cyan-rgb),.5); transform: scale(1.3);
}
.tbl-port.pk { border-color: var(--ctrl-primary); background: rgba(var(--v5-primary-rgb),.15); }
.tbl-port.fk { border-color: var(--ctrl-amber); background: rgba(253,203,110,.15); }

.tbl-col-name { flex: 1; font-weight: 500; }
.tbl-col-type { font-size: .45rem; color: var(--v5-text-muted, #777); font-weight: 600; margin-left: auto; }
.tbl-col-mark { font-size: .42rem; font-weight: 700; padding: .05rem .25rem; border-radius: 4px; margin-left: .2rem; }
.tbl-col-mark.pk { color: var(--ctrl-primary); background: rgba(var(--v5-primary-rgb),.1); }
.tbl-col-mark.fk { color: var(--ctrl-amber); background: rgba(253,203,110,.1); }

/* ═══ 제어 노드 (액션/조건/타이머) ═══ */
.ctrl-action-node {
  position: absolute; width: 160px;
  background: var(--v5-surface-solid);
  border: 1px solid rgba(var(--na-rgb, 0,206,201), .25); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08), 0 0 16px rgba(var(--na-rgb, 0,206,201), .12);
  z-index: 20; overflow: visible; transition: border-color .2s var(--v5-ease-move), box-shadow .2s var(--v5-ease-move);
}
.ctrl-action-node:hover {
  border-color: rgba(var(--na-rgb, 0,206,201), .5);
  box-shadow: 0 12px 32px rgba(0,0,0,.12), 0 0 24px rgba(var(--na-rgb, 0,206,201), .18);
}

.ctrl-an-head {
  display: flex; align-items: center; gap: .4rem; padding: .5rem .65rem;
  background: linear-gradient(135deg, rgba(var(--na-rgb, 0,206,201), .1), rgba(var(--na-rgb, 0,206,201), .03));
  border-bottom: 1px solid rgba(var(--na-rgb, 0,206,201), .12);
  border-radius: 12px 12px 0 0; cursor: grab;
}
.ctrl-an-head:active { cursor: grabbing; }
.ctrl-an-icon {
  width: 22px; height: 22px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; font-size: .8rem;
  background: linear-gradient(135deg, rgba(var(--na-rgb, 0,206,201), .18), rgba(var(--na-rgb, 0,206,201), .06));
  border: 1px solid rgba(var(--na-rgb, 0,206,201), .25);
}
.ctrl-an-name { flex: 1; font-size: .62rem; font-weight: 700; color: var(--v5-text, #e8e8ee); }
.ctrl-an-del {
  width: 18px; height: 18px; border-radius: 5px;
  border: 1px solid transparent; background: transparent;
  color: var(--v5-text-muted, #888); font-size: .55rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.ctrl-an-del:hover {
  background: rgba(var(--v5-red-rgb),.1); border-color: rgba(var(--v5-red-rgb),.3); color: var(--ctrl-red);
}

.ctrl-an-body {
  padding: .5rem .65rem; cursor: pointer;
  border-radius: 0 0 12px 12px; transition: background .15s;
}
.ctrl-an-body:hover { background: rgba(var(--na-rgb, 0,206,201), .06); }
.ctrl-an-summary { font-size: .55rem; color: var(--v5-text-sec, #aaa); line-height: 1.4; }

/* ═══ I/O 포트 ═══ */
.ctrl-io-port {
  position: absolute; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid; cursor: crosshair; transition: all .2s; z-index: 25;
}
/* 모든 port 의 hit area 확장 — ::before 로 24x24 invisible zone */
.ctrl-io-port::before {
  content: ""; position: absolute; inset: -6px;
  border-radius: 50%;
}
.ctrl-io-port.port-in {
  left: -6px; top: 50%; transform: translateY(-50%);
  border-color: var(--ctrl-cyan); background: var(--v5-surface, #2a2a36);
}
/* 테이블 컬럼 port — 짧은 수직 stripe (node cat-stripe 와 일관) */
.ctrl-io-port.tbl-io {
  width: 3px; height: 60%;
  border: none; border-radius: 2px;
  background: var(--ctrl-cyan); opacity: .7;
  cursor: crosshair;
  transition: opacity .12s linear;  /* width 트랜지션 제거 (밀려나는 느낌 없애기) */
}
.ctrl-io-port.port-in.tbl-io {
  left: 0; right: auto; top: 50%; transform: translateY(-50%);
}
.ctrl-io-port.port-out.tbl-io {
  position: absolute; left: auto; right: 0; top: 50%; transform: translateY(-50%);
}
/* PK 컬럼 stripe — 보라 강조 */
.ctrl-io-port.port-in.tbl-io.pk,
.ctrl-io-port.port-out.tbl-io.pk { background: rgb(var(--v5-primary-rgb)); }
/* hover/active — opacity + glow 만 (width 변화 X) */
.ctrl-io-port.tbl-io:hover {
  opacity: 1;
  box-shadow: 0 0 8px rgba(var(--v5-cyan-rgb), .55);
}
.ctrl-io-port.port-hover.tbl-io {
  opacity: 1 !important;
  box-shadow: 0 0 12px rgba(var(--v5-cyan-rgb), .85) !important;
}
.ctrl-io-port.port-out { border-color: var(--ctrl-cyan); background: var(--ctrl-cyan); }
.ctrl-io-port.port-yes { border-color: var(--ctrl-green); background: var(--ctrl-green); }
.ctrl-io-port.port-no { border-color: var(--v5-text-muted, #888); background: var(--v5-text-muted, #888); opacity: .6; }

.ctrl-an-ports-out {
  position: absolute; right: -6px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 8px;
}
.ctrl-an-ports-out .ctrl-io-port { position: relative; right: auto; top: auto; transform: none; }

.port-label {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: .42rem; font-weight: 700; color: var(--v5-text-muted, #888);
  pointer-events: none; white-space: nowrap;
}

.ctrl-io-port:hover { box-shadow: 0 0 10px rgba(var(--v5-cyan-rgb),.5); transform: scale(1.3); }
.ctrl-io-port.port-in:hover { background: var(--ctrl-cyan); transform: translateY(-50%) scale(1.3); }
.ctrl-io-port.port-in.tbl-io:hover { transform: scale(1.3); }
.ctrl-io-port.port-hover {
  background: var(--ctrl-cyan) !important;
  box-shadow: 0 0 14px rgba(var(--v5-cyan-rgb),.6) !important;
  transform: translateY(-50%) scale(1.5) !important;
}
.ctrl-io-port.port-hover.tbl-io { transform: scale(1.5) !important; }

/* 드래그 중 모든 input 포트 pulse */
.dash-canvas.port-dragging .ctrl-io-port.port-in { animation: portPulse 1.2s ease infinite; }
@keyframes portPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(var(--v5-cyan-rgb),.3); }
  50% { box-shadow: 0 0 14px rgba(var(--v5-cyan-rgb),.6); }
}

/* ═══ 규칙 연결선 — mockup v3 EditCanvas: solid + 둥근 join, no port 만 dashed ═══ */
.rule-temp-line {
  fill: none; stroke: var(--ctrl-cyan); stroke-width: 2;
  stroke-dasharray: 6 3;  /* 드래그 중 임시선만 점선 (cursor 따라가는 중임을 강조) */
  opacity: .7; pointer-events: none;
}
.rule-conn-path {
  fill: none; stroke: var(--ctrl-cyan); stroke-width: 2.2; opacity: .75;
  stroke-linecap: round; stroke-linejoin: round;
}
.rule-conn-path.conn-yes { stroke: var(--ctrl-green); }
.rule-conn-path.conn-no  { stroke: var(--v5-text-muted, #888); opacity: .55; stroke-dasharray: 5 4; }
/* Phase 3: edge_type 별 색상 — yes/no 가 우선이라 더 낮은 specificity */
.rule-conn-path.edge-data-context    { stroke: var(--ctrl-cyan); }                  /* 테이블 → 노드 (데이터 입력) */
.rule-conn-path.edge-execution-flow  { stroke: var(--ctrl-primary); }               /* 노드 → 노드 (실행 순서) */
.rule-conn-path.edge-table-mutation  { stroke: rgb(253, 121, 168); }                /* 노드 → 테이블 (저장/수정) */
.rule-conn-path.edge-lookup          { stroke: var(--ctrl-green); opacity: .65; stroke-dasharray: 6 4; }  /* 테이블 → 테이블 (FK) */
/* yes/no override 우선 — 명시 specificity */
.rule-conn-path.conn-yes.edge-data-context,
.rule-conn-path.conn-yes.edge-execution-flow,
.rule-conn-path.conn-yes.edge-table-mutation,
.rule-conn-path.conn-yes.edge-lookup { stroke: var(--ctrl-green); }
.rule-conn-path.conn-no.edge-data-context,
.rule-conn-path.conn-no.edge-execution-flow,
.rule-conn-path.conn-no.edge-table-mutation,
.rule-conn-path.conn-no.edge-lookup { stroke: var(--v5-text-muted, #888); stroke-dasharray: 5 4; opacity: .55; }

/* 연결 삭제 버튼 */
.rule-conn-badge {
  position: absolute; transform: translate(-50%, -50%);
  z-index: 15; pointer-events: auto; padding: 6px;
}
.conn-x {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--v5-surface-solid);
  border: 1.5px solid rgba(var(--v5-red-rgb),.15);
  color: var(--v5-text-muted, #888); font-size: .55rem; font-weight: 700; cursor: pointer;
  opacity: 0; transition: all .2s var(--v5-ease-move); transform: scale(.6);
}
.rule-conn-badge:hover .conn-x {
  opacity: 1; transform: scale(1);
  background: rgba(var(--v5-red-rgb),.15); border-color: rgba(var(--v5-red-rgb),.5); color: var(--ctrl-red);
  box-shadow: 0 2px 12px rgba(var(--v5-red-rgb),.2);
}

/* ═══ 설정 팝오버 ═══ */
.ctrl-cfg-pop {
  position: absolute; width: 220px;
  background: var(--v5-surface-solid);
  border: 1px solid rgba(var(--v5-primary-rgb),.3); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.15), 0 0 24px rgba(var(--v5-primary-rgb),.18);
  z-index: 50; padding: .7rem;
  opacity: 0; transform: translateX(-8px);
  transition: opacity .2s var(--v5-ease-move), transform .2s var(--v5-ease-move);
}
.ctrl-cfg-pop.open { opacity: 1; transform: translateX(0); }

.cfg-hd { font-size: .65rem; font-weight: 700; color: var(--v5-text, #eee);
  padding-bottom: .5rem; border-bottom: 1px solid var(--v5-border, #3a3a48); margin-bottom: .5rem; }
.cfg-sec { margin-bottom: .5rem; }
.cfg-lb { display: block; font-size: .48rem; font-weight: 700; color: var(--v5-text-muted, #888);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .15rem; }
.cfg-sel, .cfg-inp, .cfg-ta {
  width: 100%; padding: .3rem .45rem; border-radius: 7px;
  border: 1px solid var(--v5-border, #3a3a48); background: var(--v5-surface, #2a2a36);
  color: var(--v5-text, #eee); font-size: .55rem; font-family: inherit;
  outline: none; transition: border-color .15s; box-sizing: border-box;
}
.cfg-sel:focus, .cfg-inp:focus, .cfg-ta:focus { border-color: var(--ctrl-primary); }
.cfg-add-btn {
  width: 100%; padding: .25rem; border-radius: 6px;
  border: 1px dashed var(--v5-border, #3a3a48); background: transparent;
  color: var(--v5-text-muted, #888); font-size: .5rem; cursor: pointer; margin-top: .3rem;
}
.cfg-add-btn:hover { border-color: var(--ctrl-cyan); color: var(--ctrl-cyan); }
.cfg-ft {
  display: flex; gap: .3rem; padding-top: .5rem;
  border-top: 1px solid var(--v5-border, #3a3a48); margin-top: .5rem;
}
.cfg-btn {
  flex: 1; padding: .3rem; border-radius: 7px;
  border: 1px solid var(--v5-border, #3a3a48); background: var(--v5-surface, #2a2a36);
  color: var(--v5-text, #eee); font-size: .55rem; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.cfg-btn.save { background: var(--ctrl-primary); border-color: var(--ctrl-primary); color: #fff; }
.cfg-btn:hover { opacity: .85; }

/* Phase 2: schema-driven dropdown 보조 클래스 */
.cfg-empty {
  padding: .45rem .55rem; border-radius: 7px;
  background: rgba(255, 165, 2, .08);
  border: 1px dashed rgba(255, 165, 2, .35);
  color: var(--v5-text-muted, #888);
  font-size: .52rem; line-height: 1.5;
}
.cfg-static {
  display: flex; align-items: center; gap: 5px;
  padding: .3rem .45rem; border-radius: 7px;
  background: rgba(var(--v5-cyan-rgb), .06);
  border: 1px solid rgba(var(--v5-cyan-rgb), .25);
  font-size: .55rem;
}
.cfg-static-main { color: var(--v5-text); font-weight: 600; }
.cfg-static-sub {
  font-family: var(--v5-font-mono); font-size: .5rem;
  color: var(--v5-text-muted);
}
.cfg-static-hint {
  margin-left: auto;
  font-family: var(--v5-font-mono); font-size: .45rem;
  color: var(--ctrl-cyan); opacity: .7;
}
/* native select 의 optgroup label 색감 정리 */
.cfg-sel optgroup {
  font-family: var(--v5-font-mono); font-size: .5rem;
  color: var(--ctrl-cyan); font-style: normal; font-weight: 700;
}
.cfg-sel option { color: var(--v5-text); font-size: .55rem; }

/* ═══ 팔레트 ═══ */
.ctrl-palette-section {
  font-size: .52rem; font-weight: 700; color: var(--ctrl-cyan);
  text-transform: uppercase; letter-spacing: .08em; padding: .7rem .65rem .3rem;
}
.ctrl-palette-item {
  display: flex; align-items: center; gap: .5rem; padding: .45rem .65rem;
  border-radius: 8px; font-size: .68rem; font-weight: 500;
  color: var(--v5-text-sec, #aaa); cursor: grab; transition: all .2s;
}
.ctrl-palette-item:hover {
  background: rgba(var(--v5-cyan-rgb),.08); color: var(--v5-text, #eee); transform: translateX(2px);
}
.ctrl-palette-item .cp-icon { font-size: .8rem; width: 20px; text-align: center; }
.ctrl-palette-item[draggable="true"] { cursor: grab; }
.ctrl-palette-item[draggable="true"]:active { cursor: grabbing; }

/* ═══ 제어 모드 툴바 ═══ */
.ctrl-toolbar {
  display: flex; align-items: center; gap: .5rem; padding: .3rem .5rem;
  background: var(--ctrl-glass); border-bottom: 1px solid var(--ctrl-glass-border);
  font-size: .6rem;
}
.ctrl-toolbar-mode {
  display: flex; gap: .25rem;
}
.ctrl-mode-btn {
  padding: .25rem .6rem; border-radius: 6px; border: 1px solid var(--v5-border, #3a3a48);
  background: transparent; color: var(--v5-text-sec, #aaa); font-size: .55rem;
  font-weight: 600; cursor: pointer; transition: all .2s;
}
.ctrl-mode-btn.on {
  background: rgba(var(--v5-cyan-rgb),.12); border-color: var(--ctrl-cyan);
  color: var(--ctrl-cyan); font-weight: 700;
}
.ctrl-mode-btn:hover:not(.on) { background: var(--v5-surface-hover, rgba(255,255,255,.04)); }

html:not(.dark) .ctrl-action-node {
  box-shadow: 0 4px 16px rgba(0,0,0,.06), 0 0 12px rgba(var(--na-rgb, 0,206,201), .06);
}
html:not(.dark) .rule-conn-path { stroke-width: 2.5; opacity: .5; }
html:not(.dark) .ctrl-cfg-pop {
  box-shadow: 0 8px 32px rgba(0,0,0,.1); border-color: rgba(var(--v5-primary-rgb),.2);
}

/* ═══════════════════════════════════════════════════════════════════════
   카드 단위 제어 모드 (2026-05-19 v4) — mockup 컨셉
   - 카드 클릭 → 그 카드 좌측 상단으로 축소(강제 inline 덮어쓰기) + 강조
   - 그 카드 우측 옆에 부속 CardPanel (모드 토글 + 액션 + ✕)
   - 우측 빈 공간에 트리 자람(view) 또는 룰 빌더(edit)
   ═══════════════════════════════════════════════════════════════════════ */

.ctrl-mode-root {
  position: absolute; inset: 0; z-index: 30;
  pointer-events: none;
}
.ctrl-mode-root > * { pointer-events: auto; }

/* 좌상단 안내 (카드 미선택 시) */
.ctrl-mode-hint {
  position: absolute; top: 14px; left: 14px;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .75rem; border-radius: 999px;
  background: var(--v5-surface-solid);
  border: 1.5px solid var(--ctrl-cyan);
  color: var(--ctrl-cyan);
  font-size: .6rem; font-weight: 700;
  box-shadow: var(--v5-glow-cyan-sm);
  z-index: 35;
  animation: ctrlHintPulse 2.4s ease-in-out infinite;
}
@keyframes ctrlHintPulse {
  0%, 100% { box-shadow: var(--v5-glow-cyan-sm); }
  50%      { box-shadow: 0 0 24px rgba(var(--v5-cyan-rgb), .5); }
}

/* ─────────────────────────────────────────────────────────────────────
   카드 fade — 제어 모드 진입 시 자동
   ───────────────────────────────────────────────────────────────────── */

/* 기본: 약한 fade + 클릭 가능 (카드 미선택 상태) */
.dash-canvas.control-mode [data-card-id] {
  cursor: pointer;
  opacity: .55;
  transition: all .35s cubic-bezier(.16, 1, .3, 1);
}
.dash-canvas.control-mode [data-card-id]:hover {
  opacity: .92;
  box-shadow: var(--v5-glow-cyan-sm), 0 0 28px rgba(var(--v5-cyan-rgb), .35);
}
.dash-canvas.control-mode [data-card-id] > * {
  pointer-events: none;
}

/* 선택된 카드 = 좌측 상단 강제 축소 (inline style !important 로 덮어쓰기) */
.dash-canvas.control-mode [data-card-id][data-flow-active="1"] {
  left: 20px !important;
  top: 80px !important;
  width: 320px !important;
  height: 220px !important;
  opacity: 1 !important;
  z-index: 25;
  box-shadow: 0 0 36px rgba(var(--v5-cyan-rgb), .55), var(--v5-glow-md) !important;
  border: 1.5px solid var(--ctrl-cyan);
  cursor: default;
  overflow: hidden;
}
.dash-canvas.control-mode [data-card-id][data-flow-active="1"]:hover {
  opacity: 1 !important;
}
.dash-canvas.control-mode [data-card-id][data-flow-active="1"] > * {
  pointer-events: none;
  opacity: .85;
}

/* 선택된 카드 외 — 더 강하게 fade (구분) */
.dash-canvas.control-mode:has([data-flow-active="1"]) [data-card-id]:not([data-flow-active="1"]) {
  opacity: .12;
  pointer-events: none;
  cursor: default;
}
.dash-canvas.control-mode:has([data-flow-active="1"]) [data-card-id]:not([data-flow-active="1"]):hover {
  opacity: .12;
  box-shadow: none;
}

/* edit 모드 — 선택 카드도 좀 더 흐리게 (룰 빌더가 더 전면) */
.dash-canvas.control-mode-edit [data-card-id][data-flow-active="1"] {
  opacity: .55 !important;
}
.dash-canvas.control-mode-edit [data-card-id]:not([data-flow-active="1"]) {
  opacity: .06 !important;
}

/* ─────────────────────────────────────────────────────────────────────
   ControlCardPanel — 선택 카드 우측 옆 floating
   카드는 left:20, w:320 → 패널은 left:360 부근에 떠 있음
   ───────────────────────────────────────────────────────────────────── */
.ctrl-card-panel {
  position: absolute; left: 360px; top: 80px;
  width: 250px;
  display: flex; flex-direction: column; gap: .45rem;
  padding: .6rem .7rem;
  background: var(--v5-surface-solid);
  border: 1.5px solid var(--ctrl-cyan);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .15), var(--v5-glow-cyan-sm);
  z-index: 40;
  animation: ctrlPanelSlide .35s cubic-bezier(.16, 1, .3, 1);
}
@keyframes ctrlPanelSlide {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.ctrl-card-panel-head {
  display: flex; align-items: center; gap: .4rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--v5-border-subtle);
}
.ctrl-card-panel-icon {
  width: 24px; height: 24px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(var(--v5-cyan-rgb), .25), rgba(var(--v5-cyan-rgb), .08));
  border: 1px solid rgba(var(--v5-cyan-rgb), .3);
  font-size: .8rem;
  flex-shrink: 0;
}
.ctrl-card-panel-title-wrap {
  flex: 1; min-width: 0;
}
.ctrl-card-panel-title {
  font-size: .65rem; font-weight: 700; color: var(--v5-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ctrl-card-panel-type {
  font-size: .42rem; font-weight: 600; color: var(--v5-text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-top: 1px;
}
.ctrl-card-panel-close {
  width: 20px; height: 20px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--v5-border);
  color: var(--v5-text-muted); cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.ctrl-card-panel-close:hover {
  border-color: var(--ctrl-red);
  color: var(--ctrl-red);
  background: rgba(255, 71, 87, .08);
}

.ctrl-card-panel-source { display: flex; }
.ctrl-card-panel-source-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .15rem .45rem; border-radius: 999px;
  background: rgba(var(--v5-pink-rgb), .1);
  border: 1px solid rgba(var(--v5-pink-rgb), .35);
  color: var(--ctrl-pink);
  font-size: .5rem; font-weight: 700; font-family: monospace;
  user-select: none;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ctrl-card-panel-source-chip[draggable="true"] {
  cursor: grab; transition: all .15s;
}
.ctrl-card-panel-source-chip[draggable="true"]:hover {
  background: rgba(var(--v5-pink-rgb), .18);
  border-color: var(--ctrl-pink);
  box-shadow: 0 0 12px rgba(var(--v5-pink-rgb), .3);
}
.ctrl-card-panel-source-chip[draggable="true"]:active { cursor: grabbing; }

/* segmented mode toggle (카드 패널 안) */
.ctrl-card-panel-mode {
  display: flex; gap: 2px;
  padding: 2px; border-radius: 7px;
  background: var(--v5-surface-hover);
  border: 1px solid var(--v5-border-subtle);
}
.ctrl-card-panel-mode-btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center;
  gap: .25rem;
  padding: .3rem .4rem; border-radius: 5px;
  border: none; background: transparent;
  color: var(--v5-text-sec);
  font-size: .55rem; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.ctrl-card-panel-mode-btn:hover:not(.on) {
  color: var(--v5-text);
  background: rgba(var(--v5-cyan-rgb), .06);
}
.ctrl-card-panel-mode-btn.on {
  background: linear-gradient(135deg, var(--ctrl-cyan), #2ed5d0);
  color: #0a0a0f; font-weight: 700;
  box-shadow: 0 2px 6px rgba(var(--v5-cyan-rgb), .35);
}

.ctrl-card-panel-actions {
  display: flex; gap: .3rem;
}
.ctrl-card-panel-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .2rem;
  padding: .3rem .45rem; border-radius: 6px;
  border: 1px solid var(--v5-border);
  background: var(--v5-surface-solid);
  color: var(--v5-text-sec);
  font-size: .5rem; font-weight: 600; cursor: pointer;
  transition: all .15s;
  flex: 1;
  overflow: hidden;
}
.ctrl-card-panel-btn:hover:not(:disabled) {
  border-color: var(--ctrl-cyan);
  color: var(--ctrl-cyan);
  box-shadow: var(--v5-glow-cyan-sm);
}
.ctrl-card-panel-btn:disabled { opacity: .4; cursor: not-allowed; }
.ctrl-card-panel-btn.primary {
  background: linear-gradient(135deg, var(--v5-primary), #8b7ee8);
  border-color: var(--v5-primary);
  color: #fff;
  box-shadow: var(--v5-glow-sm);
}
.ctrl-card-panel-btn.primary:hover:not(:disabled) {
  box-shadow: var(--v5-glow-md);
  filter: brightness(1.08);
}

.ctrl-card-panel-status {
  font-size: .45rem; font-weight: 600;
  color: var(--v5-text-muted); text-align: center;
  letter-spacing: .04em;
}
.ctrl-card-panel-hint {
  font-size: .48rem; color: var(--v5-text-muted);
  text-align: center; font-style: italic;
  padding: .25rem 0;
}

.ctrl-card-panel-dropdown {
  position: absolute; bottom: 100%; left: 0; margin-bottom: 4px;
  min-width: 200px; max-height: 200px; overflow-y: auto;
  background: var(--v5-surface-solid);
  border: 1px solid var(--v5-border);
  border-radius: 10px; padding: .25rem;
  box-shadow: 0 -12px 32px rgba(0, 0, 0, .15), var(--v5-glow-sm);
  z-index: 100;
}
.ctrl-card-panel-dropdown-item {
  display: block; width: 100%; text-align: left;
  padding: .3rem .5rem; border-radius: 5px;
  border: none; background: transparent;
  color: var(--v5-text-sec);
  font-size: .52rem; font-weight: 500; cursor: pointer;
  transition: all .12s;
}
.ctrl-card-panel-dropdown-item:hover {
  background: rgba(var(--v5-cyan-rgb), .08);
  color: var(--ctrl-cyan);
}
.ctrl-card-panel-dropdown-item.active {
  background: rgba(var(--v5-cyan-rgb), .14);
  color: var(--ctrl-cyan);
  font-weight: 700;
}

/* ─────────────────────────────────────────────────────────────────────
   ❸ 팔레트 보강 (검색 + 추천 + max-height + 한국어)
   ───────────────────────────────────────────────────────────────────── */
.ctrl-palette {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0; height: 100%;
  overflow: hidden;
}
.ctrl-palette-header {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: .55rem .7rem .3rem;
  border-bottom: 1px solid var(--v5-border-subtle);
}
.ctrl-palette-header-title {
  font-size: .58rem; font-weight: 700; color: var(--ctrl-cyan);
  text-transform: uppercase; letter-spacing: .08em;
}
.ctrl-palette-header-hint {
  font-size: .48rem; color: var(--v5-text-muted); font-weight: 500;
}

.ctrl-palette-search-wrap {
  flex-shrink: 0; position: relative;
  padding: .4rem .65rem .15rem;
}
.ctrl-palette-search-icon {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-30%);
  color: var(--v5-text-muted); pointer-events: none; z-index: 1;
}
.ctrl-palette-search {
  width: 100%; padding: .3rem .5rem .3rem 1.45rem;
  border-radius: 7px;
  border: 1px solid var(--v5-border);
  background: var(--v5-surface-solid);
  color: var(--v5-text);
  font-size: .55rem; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.ctrl-palette-search::placeholder { color: var(--v5-text-muted); }
.ctrl-palette-search:focus {
  border-color: var(--ctrl-cyan);
  box-shadow: var(--v5-glow-cyan-sm);
}
.ctrl-palette-search:disabled { opacity: .4; cursor: not-allowed; }

.ctrl-palette-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  transition: opacity .15s;
}
.ctrl-palette-scroll.disabled { opacity: .35; }

.ctrl-palette-section-rec {
  display: flex; align-items: center; gap: .2rem;
  color: var(--v5-amber, #fdcb6e) !important;
}
.ctrl-palette-section-count {
  margin-left: auto;
  font-size: .42rem; font-weight: 600;
  padding: .05rem .3rem; border-radius: 999px;
  background: var(--v5-surface-hover);
  color: var(--v5-text-muted);
  letter-spacing: 0; text-transform: none;
}

.ctrl-palette-tables {
  padding: 0 .2rem .3rem;
}
.ctrl-palette-tables-others {
  max-height: 260px; overflow-y: auto;
  border-bottom: 1px solid var(--v5-border-subtle);
  margin-bottom: .25rem;
}

.ctrl-palette-item-rec {
  background: rgba(var(--v5-amber-rgb, 253, 203, 110), .04);
  position: relative;
}
.ctrl-palette-item-rec:hover {
  background: rgba(var(--v5-amber-rgb, 253, 203, 110), .12);
}
.cp-rec-star {
  color: var(--v5-amber, #fdcb6e);
  fill: currentColor;
  flex-shrink: 0;
}

.ctrl-palette-item .cp-label {
  display: flex; flex-direction: column; gap: 1px;
  min-width: 0; flex: 1; overflow: hidden;
}
.ctrl-palette-item .cp-label-main {
  font-size: .62rem; font-weight: 600; color: var(--v5-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.2;
}
.ctrl-palette-item .cp-label-sub {
  font-size: .44rem; color: var(--v5-text-muted);
  font-family: monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.2;
}

.ctrl-palette-empty {
  padding: .8rem .7rem; font-size: .55rem;
  color: var(--v5-text-muted);
  text-align: center; font-style: italic;
}

/* ── 라이트 모드 보정 ── */
html:not(.dark) .ctrl-overlay-backdrop { opacity: .88; }
html:not(.dark) .ctrl-card-hotspot {
  background: rgba(var(--v5-cyan-rgb), .03);
  border-color: rgba(var(--v5-cyan-rgb), .55);
}
html:not(.dark) .ctrl-card-hotspot:hover {
  background: rgba(var(--v5-cyan-rgb), .06);
  box-shadow: 0 0 24px rgba(var(--v5-cyan-rgb), .28), 0 8px 32px rgba(0, 0, 0, .08);
}

/* ═══════════════════════════════════════════════════════════════════════════
   v3 시안 통합 — 2026-05-19
   참조: INVYONE Design System (2).zip / control-mode/styles.css
        /Users/gbpark/Downloads/control-mode.standalone.html
   "Control IDE" takeover 디자인 — v5 토큰 100%, 즉흥 hex 금지
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── 제어 토글 — cyan + green 그라데이션 + bounce in ───
   AppLayout 의 <button className="ud-htool on" data-mode="ctrl"> 적용 */
.ud-htool[data-mode="ctrl"].on {
  background: linear-gradient(135deg,
              rgba(var(--v5-cyan-rgb), .95),
              rgba(var(--v5-green-rgb), .95)) !important;
  color: #06050e !important;
  border-color: transparent !important;
  box-shadow:
    0 0 0 1px rgba(var(--v5-cyan-rgb), .4),
    0 0 40px rgba(var(--v5-cyan-rgb), .22) !important;
  font-weight: 700;
  animation: ctrl-toggle-in .45s var(--v5-ease-enter) both;
}
.ud-htool[data-mode="ctrl"].on:hover {
  box-shadow:
    0 0 0 1px rgba(var(--v5-cyan-rgb), .5),
    0 0 50px rgba(var(--v5-cyan-rgb), .32) !important;
}
/* 그라데이션이 강조 역할을 하므로 기본 underline 은 숨김 */
.ud-htool[data-mode="ctrl"].on::before { display: none; }
@keyframes ctrl-toggle-in {
  0%   { transform: scale(.85); opacity: .4; }
  60%  { transform: scale(1.06); }
  100% { transform: scale(1);    opacity: 1; }
}

/* ─── 카테고리 칩 — palette/inspector/canvas 공용 (v3 .cat-chip + .c-*) ─── */
.cat-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--v5-font-mono);
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.c-trigger { color: rgb(var(--v5-cyan-rgb)); }
.c-cond    { color: rgb(var(--v5-amber-rgb)); }
.c-action  { color: rgb(var(--v5-primary-rgb)); }
.c-flow    { color: rgb(var(--v5-pink-rgb)); }
.c-extern  { color: rgb(var(--v5-green-rgb)); }
.c-log     { color: #6b6b76; }
.dark .c-log { color: #9aa0a6; }

/* ─── IDE takeover 5-분할 grid 골격 (V3Takeover 미러, 단계 2 부터 사용) ─── */
.ctrl-ide-shell {
  position: absolute; inset: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: 248px 1fr 304px;
  grid-template-rows: 44px 1fr 32px;
  background: var(--v5-surface-solid);
  border: 1px solid rgba(var(--v5-cyan-rgb), .3);
  box-shadow:
    0 0 0 4px rgba(var(--v5-cyan-rgb), .08),
    0 30px 60px -20px rgba(0, 0, 0, .2);
  animation: ctrl-ide-in .35s var(--v5-ease-enter) both;
}
@keyframes ctrl-ide-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.ctrl-ide-ctxbar {
  grid-column: 1 / span 3; grid-row: 1;
  display: flex; align-items: center; gap: 10px;
  padding: 0 .85rem;
  background: var(--v5-surface-solid);
  border-bottom: 1px solid var(--v5-border);
}
.ctrl-ide-leftrail {
  grid-column: 1; grid-row: 2;
  overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--v5-surface-solid);
}
.ctrl-ide-canvas {
  grid-column: 2; grid-row: 2;
  position: relative;
  border-left: 1px solid var(--v5-border);
  border-right: 1px solid var(--v5-border);
  overflow: hidden;
  background: var(--v5-surface-solid);
}
.ctrl-ide-rightrail {
  grid-column: 3; grid-row: 2;
  overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--v5-surface-solid);
}
.ctrl-ide-statusbar {
  grid-column: 1 / span 3; grid-row: 3;
  display: flex; align-items: center;
  padding: 0 .85rem;
  background: var(--v5-bg-subtle);
  border-top: 1px solid var(--v5-border);
  font-family: var(--v5-font-mono);
  font-size: .62rem;
  color: var(--v5-text-sec);
  gap: 14px;
}

/* ContextBar — IDE 좌측 cyan glow 배지 */
.ctrl-ide-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  background: linear-gradient(135deg,
              rgba(var(--v5-cyan-rgb), .18),
              rgba(var(--v5-primary-rgb), .10));
  border: 1px solid rgba(var(--v5-cyan-rgb), .35);
  color: rgb(0, 154, 150);
  border-radius: 6px;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .06em;
  font-family: var(--v5-font-mono);
  text-transform: uppercase;
}
.dark .ctrl-ide-badge { color: rgb(var(--v5-cyan-rgb)); }

/* ContextBar — brumb separator */
.ctrl-ide-sep {
  color: var(--v5-text-muted);
  font-size: .7rem;
}

/* ContextBar — 모드 4-segmented tabs (READ/EDIT/RUN/HISTORY) */
.ctrl-ide-mode-tabs {
  display: flex; gap: 2px;
  padding: 2px;
  background: var(--v5-bg-subtle);
  border: 1px solid var(--v5-border);
  border-radius: 7px;
}
.ctrl-ide-mode-tab {
  padding: 4px 11px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: .7rem;
  font-weight: 600;
  color: var(--v5-text-muted);
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background .18s var(--v5-ease-move),
              color .18s var(--v5-ease-move);
}
.ctrl-ide-mode-tab:hover { color: var(--v5-text-sec); }
.ctrl-ide-mode-tab.on {
  background: var(--v5-surface-solid);
  color: var(--v5-text);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, .05),
    0 0 0 1px var(--v5-border);
}
.ctrl-ide-mode-tab svg { width: 10px; height: 10px; stroke-width: 2; }

/* ContextBar — 우측 작은 툴 버튼 */
.ctrl-ide-tool {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  height: 26px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: .7rem;
  font-weight: 600;
  color: var(--v5-text-sec);
  cursor: pointer;
  transition: background .18s var(--v5-ease-move),
              color .18s var(--v5-ease-move);
}
.ctrl-ide-tool:hover {
  background: var(--v5-surface-hover);
  color: var(--v5-text);
}
.ctrl-ide-tool.primary {
  background: rgb(var(--v5-primary-rgb));
  color: #fff;
  font-weight: 700;
}
.ctrl-ide-tool.primary:hover { filter: brightness(1.08); }
.ctrl-ide-tool svg { width: 11px; height: 11px; stroke-width: 2; }

/* ─── Section Header — Rail 안 섹션 헤더 (v3 SectionHeader 미러) ─── */
.ctrl-sec-head {
  display: flex; align-items: center;
  padding: 8px 12px 6px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--v5-text-sec);
}
.ctrl-sec-head .ctrl-sec-ico {
  margin-right: 6px;
  display: inline-flex;
  color: inherit;
}
.ctrl-sec-head .ctrl-sec-count {
  margin-left: 4px;
  font-family: var(--v5-font-mono);
  font-size: .55rem;
  color: var(--v5-text-muted);
  font-weight: 600;
}
.ctrl-sec-head .ctrl-sec-right { margin-left: auto; }

/* ─── FAB — 카드 선택 전 (제어 ON 상태 안내 + 종료) (v3 .fab) ─── */
.ctrl-fab {
  position: absolute;
  bottom: 18px; right: 18px;
  z-index: 40;
  background: var(--v5-surface-solid);
  border: 1px solid var(--v5-border);
  border-radius: 999px;
  padding: 6px 10px 6px 14px;
  box-shadow:
    0 0 16px rgba(var(--v5-cyan-rgb), .2),
    0 10px 30px -10px rgba(0, 0, 0, .18);
  display: flex; align-items: center; gap: 8px;
  font-size: .72rem; font-weight: 600;
  color: var(--v5-text);
  animation: ctrl-fab-in .35s var(--v5-ease-enter) both;
}
.ctrl-fab .ctrl-fab-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgb(var(--v5-cyan-rgb));
  box-shadow: 0 0 8px rgb(var(--v5-cyan-rgb));
  animation: ctrl-fab-pulse 1.4s infinite;
}
.ctrl-fab .ctrl-fab-sep {
  width: 1px; height: 14px;
  background: var(--v5-border);
}
.ctrl-fab .ctrl-fab-x {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: none;
  background: var(--v5-bg-subtle);
  border-radius: 6px;
  cursor: pointer;
  color: var(--v5-text-sec);
  transition: background .18s var(--v5-ease-move),
              color .18s var(--v5-ease-move);
}
.ctrl-fab .ctrl-fab-x:hover {
  background: rgba(var(--v5-red-rgb), .1);
  color: rgb(var(--v5-red-rgb));
}
.ctrl-fab .ctrl-fab-x svg { width: 11px; height: 11px; stroke-width: 2.5; }
@keyframes ctrl-fab-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes ctrl-fab-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .3; }
}

/* ─── Empty-state 안내 칩 — 제어 ON, 카드 미선택 (v3 V3Hint) ─── */
.ctrl-mode-hint {
  position: absolute;
  top: 18px; left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  display: inline-flex; align-items: center; gap: 10px;
  padding: .55rem 1.1rem;
  background: var(--v5-surface-solid);
  border: 1px solid rgba(var(--v5-cyan-rgb), .35);
  border-radius: 999px;
  box-shadow:
    0 0 0 4px rgba(var(--v5-cyan-rgb), .08),
    0 10px 24px -8px rgba(var(--v5-cyan-rgb), .25);
  font-size: .74rem;
  font-weight: 600;
  color: var(--v5-text);
  white-space: nowrap;
  pointer-events: none;
  animation: ctrl-fab-in .35s var(--v5-ease-enter) both;
}
.ctrl-mode-hint b { color: rgb(0, 154, 150); }
.dark .ctrl-mode-hint b { color: rgb(var(--v5-cyan-rgb)); }

/* ─── Mini Topology Popover — 카드 호버 시 (v3 .dh-hpop) ─── */
.ctrl-hpop {
  position: absolute;
  z-index: 60;
  width: 230px;
  background: var(--v5-surface-solid);
  border: 1px solid rgba(var(--v5-cyan-rgb), .35);
  border-radius: 12px;
  padding: .65rem .7rem;
  box-shadow:
    0 0 16px rgba(var(--v5-cyan-rgb), .2),
    0 16px 40px -12px rgba(0, 0, 0, .15);
  pointer-events: none;
  animation: ctrl-hpop-in .22s var(--v5-ease-enter);
}
@keyframes ctrl-hpop-in {
  from { opacity: 0; transform: translateY(-4px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ctrl-hpop .ctrl-hpop-l {
  font-family: var(--v5-font-mono);
  font-size: .55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgb(var(--v5-cyan-rgb));
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 5px;
}
.ctrl-hpop .ctrl-hpop-l::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgb(var(--v5-cyan-rgb));
  box-shadow: 0 0 6px rgb(var(--v5-cyan-rgb));
  animation: ctrl-fab-pulse 1.4s infinite;
}
.ctrl-hpop .ctrl-hpop-t {
  font-size: .75rem;
  font-weight: 700;
  color: var(--v5-text);
  margin-bottom: .3rem;
}
.ctrl-hpop .ctrl-hpop-svg {
  width: 100%; height: 64px;
  background: var(--v5-bg-subtle);
  border-radius: 6px;
  border: 1px solid var(--v5-border-subtle);
}
.ctrl-hpop .ctrl-hpop-stats {
  display: flex; gap: .55rem;
  margin-top: .4rem;
  font-family: var(--v5-font-mono);
  font-size: .6rem;
  color: var(--v5-text-sec);
  font-weight: 600;
}
.ctrl-hpop .ctrl-hpop-stats b {
  color: var(--v5-text);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════════════════
   IDE 컴포넌트 CSS — ContextBar / LeftRail / RightRail / Canvas / StatusBar
   2026-05-19
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── ContextBar ─── */
.ctrl-ide-crumb-card {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .74rem; font-weight: 700;
  color: var(--v5-text);
}
.ctrl-ide-crumb-tbl {
  font-family: var(--v5-font-mono);
  font-size: .6rem;
  color: var(--v5-text-muted);
  font-weight: 500;
  margin-left: 4px;
}
.ctrl-ide-cmdk {
  height: 22px;
  padding: 0 7px;
  font-family: var(--v5-font-mono);
  font-size: .6rem;
}
.ctrl-ide-vsep {
  width: 1px; height: 20px;
  background: var(--v5-border);
  flex-shrink: 0;
}
.ctrl-ide-close {
  border: 1px solid var(--v5-border);
  background: var(--v5-surface-solid);
}
.ctrl-ide-exit {
  color: rgb(var(--v5-red-rgb)) !important;
}
.ctrl-ide-exit:hover {
  background: rgba(var(--v5-red-rgb), .08) !important;
}

/* ─── LeftRail · 섹션 토글 ─── */
.ctrl-sec-toggle {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}
.ctrl-sec-toggle:hover { background: var(--v5-surface-hover); }

/* ─── LeftRail · 카드 목록 ─── */
.ctrl-ide-cards {
  display: flex; flex-direction: column;
  gap: 2px;
  padding: 0 6px 6px;
  overflow-y: auto;
  max-height: 30%;
  border-bottom: 1px solid var(--v5-border-subtle);
}
.ctrl-ide-card-row {
  display: flex; flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  transition: background .15s var(--v5-ease-move), border-color .15s var(--v5-ease-move);
}
.ctrl-ide-card-row:hover {
  background: var(--v5-surface-hover);
}
.ctrl-ide-card-row.on {
  background: rgba(var(--v5-cyan-rgb), .08);
  border-color: rgba(var(--v5-cyan-rgb), .35);
}
.ctrl-ide-card-row-title {
  font-size: .72rem;
  font-weight: 700;
  color: var(--v5-text);
}
.ctrl-ide-card-row-tbl {
  font-family: var(--v5-font-mono);
  font-size: .56rem;
  color: var(--v5-text-muted);
}
.ctrl-ide-empty {
  padding: .8rem .7rem;
  font-size: .62rem;
  color: var(--v5-text-muted);
  text-align: center;
  font-style: italic;
}

/* ─── LeftRail · 노드 팔레트 ─── */
.ctrl-ide-palette-search {
  display: flex; align-items: center;
  gap: 5px;
  margin: 6px 8px;
  padding: 5px 8px;
  background: var(--v5-bg-subtle);
  border: 1px solid var(--v5-border);
  border-radius: 6px;
  color: var(--v5-text-muted);
}
.ctrl-ide-palette-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: .68rem;
  color: var(--v5-text);
}
.ctrl-ide-palette {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
}
.ctrl-ide-palette-cat {
  margin-top: 8px;
}
.ctrl-ide-palette-cat-label {
  padding: 4px 0;
}
.ctrl-ide-palette-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 4px;
}
.ctrl-ide-palette-item {
  display: flex; align-items: center;
  gap: 5px;
  padding: 6px 7px;
  background: var(--v5-surface-solid);
  border: 1px solid var(--v5-border);
  border-radius: 6px;
  cursor: grab;
  font-family: inherit;
  text-align: left;
  transition: background .15s var(--v5-ease-move),
              border-color .15s var(--v5-ease-move),
              transform .12s var(--v5-ease-move);
}
.ctrl-ide-palette-item:hover {
  background: var(--v5-surface-hover);
  border-color: rgba(var(--v5-cyan-rgb), .35);
  transform: translateY(-1px);
}
.ctrl-ide-palette-item:active { cursor: grabbing; }
.ctrl-ide-palette-ico {
  font-size: .8rem;
  width: 18px; height: 18px;
  display: grid; place-items: center;
}
.ctrl-ide-palette-label {
  font-size: .62rem;
  font-weight: 600;
  color: var(--v5-text);
}

/* ─── RightRail · Inspector ─── */
.ctrl-ide-inspector {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
  display: flex; flex-direction: column;
  gap: 10px;
}
.ctrl-ide-field {
  display: flex; flex-direction: column;
  gap: 4px;
}
.ctrl-ide-field-label {
  font-size: .62rem;
  font-weight: 700;
  color: var(--v5-text-sec);
  letter-spacing: .01em;
}
.ctrl-ide-field-locked {
  font-size: .56rem;
  color: var(--v5-text-muted);
  font-weight: 500;
}
.ctrl-ide-field-input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--v5-border);
  background: var(--v5-surface-solid);
  border-radius: 5px;
  font-family: inherit;
  font-size: .7rem;
  color: var(--v5-text);
  outline: none;
  transition: border-color .15s var(--v5-ease-move),
              box-shadow .15s var(--v5-ease-move);
}
.ctrl-ide-field-input:focus {
  border-color: rgba(var(--v5-primary-rgb), .5);
  box-shadow: 0 0 0 2px rgba(var(--v5-primary-rgb), .12);
}
.ctrl-ide-field-input:disabled {
  background: var(--v5-bg-subtle);
  color: var(--v5-text-muted);
  cursor: not-allowed;
}
.ctrl-ide-field-input.mono {
  font-family: var(--v5-font-mono);
}
.ctrl-ide-field-hint {
  font-family: var(--v5-font-mono);
  font-size: .58rem;
  color: var(--v5-text-muted);
}
.ctrl-ide-field-meta {
  display: flex; flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  background: var(--v5-bg-subtle);
  border-radius: 6px;
}
.ctrl-ide-field-meta > div {
  display: flex; align-items: center;
  gap: 8px;
  font-size: .64rem;
}
.ctrl-ide-field-row {
  display: flex; align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: .68rem;
}
.ctrl-ide-field-row:nth-child(odd) { background: var(--v5-bg-subtle); }
.ctrl-ide-field-k {
  font-family: var(--v5-font-mono);
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--v5-text-muted);
  min-width: 56px;
}
.ctrl-ide-card-info {
  margin: 0 12px;
  border: 1px solid var(--v5-border-subtle);
  border-radius: 6px;
  overflow: hidden;
}
.ctrl-ide-help {
  padding: 0 12px;
  font-size: .68rem;
  color: var(--v5-text-sec);
  line-height: 1.5;
}
.ctrl-ide-help p { margin: 6px 0; }
.ctrl-ide-help b { color: var(--v5-text); font-weight: 700; }

/* Inspector stats */
.ctrl-ide-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 0 12px;
}
.ctrl-ide-stats > div {
  display: flex; align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--v5-bg-subtle);
  border-radius: 5px;
  font-size: .64rem;
}
.ctrl-ide-stats code {
  font-family: var(--v5-font-mono);
  font-size: .66rem;
  color: var(--v5-text);
  font-weight: 700;
}
.ctrl-ide-stat-alert {
  grid-column: 1 / span 2;
  padding: 6px 8px;
  background: rgba(var(--v5-amber-rgb), .12);
  border: 1px solid rgba(var(--v5-amber-rgb), .35);
  color: rgb(var(--v5-amber-rgb));
  border-radius: 5px;
  font-size: .62rem;
  font-weight: 600;
}

/* Inspector comments */
.ctrl-ide-comments {
  display: flex; flex-direction: column;
  gap: 6px;
  padding: 0 12px;
}
.ctrl-ide-comment {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  padding: 6px 8px;
  background: var(--v5-bg-subtle);
  border-radius: 5px;
}
.ctrl-ide-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: .58rem;
  font-weight: 700;
}
.ctrl-ide-comment-meta {
  font-size: .58rem;
  color: var(--v5-text-muted);
}
.ctrl-ide-comment-meta b { color: var(--v5-text); font-weight: 700; }
.ctrl-ide-comment-text {
  font-size: .66rem;
  color: var(--v5-text);
  margin-top: 2px;
}
.ctrl-ide-mini {
  height: 22px !important;
  padding: 0 6px !important;
}

/* Inspector — validation dot */
.ctrl-validation-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.ctrl-validation-dot.ok  { background: var(--v5-green); box-shadow: 0 0 6px var(--v5-green); }
.ctrl-validation-dot.bad { background: var(--v5-red);   box-shadow: 0 0 6px var(--v5-red); }

/* ─── Canvas — 공통 ─── */
.ctrl-ide-canvas-inner {
  position: absolute; inset: 0;
}
/* EditCanvas → RuleBuilder host (RuleBuilder 는 position:absolute, inset:0) */
.ctrl-edit-canvas-host {
  position: absolute; inset: 0;
  overflow: hidden;
}
/* RuleBuilder 캔버스 — v3 EditCanvas mockup 의 dot 패턴 배경 (solid + 보라톤 도트) */
.rule-builder-canvas {
  background-color: var(--v5-surface-solid);
  background-image: radial-gradient(circle, rgba(var(--v5-primary-rgb), .16) 0.8px, transparent 1.2px);
  background-size: 16px 16px;
  background-position: 0 0;
}
.ctrl-canvas-tag {
  font-family: var(--v5-font-mono);
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ctrl-canvas-mono {
  font-family: var(--v5-font-mono);
  font-size: .6rem;
  color: var(--v5-text-muted);
}
.ctrl-canvas-relnode {
  background: var(--v5-surface-solid);
  border-width: 1.5px;
  border-style: solid;
  border-radius: 10px;
  padding: .55rem .7rem;
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .10);
}
.ctrl-canvas-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  color: var(--v5-text-muted);
  font-size: .8rem;
  font-style: italic;
}
.ctrl-canvas-empty small {
  font-family: var(--v5-font-mono);
  font-size: .58rem;
  font-style: normal;
}

/* ─── PanZoomStage ─── */
.ctrl-pz-stage {
  position: absolute; inset: 0;
  overflow: hidden;
}
.ctrl-pz-zoom {
  position: absolute; bottom: 12px; right: 12px;
  z-index: 10;
  display: flex; gap: 4px;
  background: var(--v5-surface-solid);
  border: 1px solid var(--v5-border);
  border-radius: 7px;
  padding: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}
.ctrl-pz-zoom button {
  width: 24px; height: 24px;
  border: none;
  background: transparent;
  border-radius: 5px;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--v5-text-sec);
  transition: background .15s var(--v5-ease-move), color .15s var(--v5-ease-move);
}
.ctrl-pz-zoom button:hover {
  background: var(--v5-surface-hover);
  color: var(--v5-text);
}
.ctrl-pz-pct {
  padding: 0 7px;
  font-family: var(--v5-font-mono);
  font-size: .6rem;
  font-weight: 700;
  color: var(--v5-text-sec);
  display: inline-flex; align-items: center;
}
.ctrl-pz-hint {
  position: absolute; bottom: 12px; left: 12px;
  z-index: 10;
  padding: 4px 9px;
  background: var(--v5-surface-solid);
  border: 1px solid var(--v5-border);
  border-radius: 999px;
  font-family: var(--v5-font-mono);
  font-size: .58rem;
  font-weight: 600;
  color: var(--v5-text-muted);
  display: inline-flex; align-items: center;
  gap: 5px;
}

/* ─── Run mode ─── */
.ctrl-run-shell {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
}
.ctrl-run-top {
  padding: .8rem 1rem;
  background: linear-gradient(135deg, rgba(var(--v5-cyan-rgb), .08), rgba(var(--v5-primary-rgb), .05));
  border-bottom: 1px solid var(--v5-border);
  display: flex; align-items: center; gap: 14px;
}
.ctrl-run-state {
  width: 36px; height: 36px;
  border-radius: 9px;
  color: #fff;
  display: grid; place-items: center;
}
.ctrl-run-state.playing {
  background: var(--v5-green);
  box-shadow: 0 0 20px rgba(var(--v5-green-rgb), .4);
}
.ctrl-run-state.paused {
  background: var(--v5-amber);
  box-shadow: 0 0 20px rgba(var(--v5-amber-rgb), .4);
}
.ctrl-canvas-tag.is-play  { color: var(--v5-green); }
.ctrl-canvas-tag.is-pause { color: var(--v5-amber); }
.ctrl-run-btns {
  display: flex; gap: 3px;
  padding: 3px;
  background: var(--v5-surface-solid);
  border: 1px solid var(--v5-border);
  border-radius: 8px;
}
.ctrl-run-btn {
  width: 28px; height: 24px;
  border: none;
  background: transparent;
  color: var(--v5-text-sec);
  border-radius: 5px;
  cursor: pointer;
  display: grid; place-items: center;
}
.ctrl-run-btn:hover { background: var(--v5-surface-hover); color: var(--v5-text); }
.ctrl-run-btn.primary {
  background: rgb(var(--v5-primary-rgb));
  color: #fff;
  box-shadow: var(--v5-glow-sm);
}
.ctrl-run-counter {
  text-align: right;
  min-width: 80px;
}
.ctrl-run-counter-num {
  font-family: var(--v5-font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--v5-text);
  letter-spacing: -.02em;
}
.ctrl-run-progress {
  height: 3px;
  background: var(--v5-bg-subtle);
  position: relative; overflow: hidden;
}
.ctrl-run-progress-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(var(--v5-cyan-rgb), .85), rgba(var(--v5-primary-rgb), .85));
  transition: width .5s ease-out;
}
.ctrl-run-steps {
  flex: 1; overflow: auto;
  padding: .9rem 1rem;
  display: flex; flex-direction: column;
  gap: 7px;
}
.ctrl-run-step {
  display: grid;
  grid-template-columns: 28px 24px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  background: var(--v5-surface-solid);
  border: 1px solid var(--v5-border-subtle);
  border-radius: 8px;
  transition: background .2s var(--v5-ease-move), border-color .2s var(--v5-ease-move);
}
.ctrl-run-step.is-active {
  background: rgba(var(--v5-cyan-rgb), .06);
  border-color: rgba(var(--v5-cyan-rgb), .4);
  box-shadow: 0 0 0 3px rgba(var(--v5-cyan-rgb), .08);
}
.ctrl-run-step.is-pending { opacity: .45; }
.ctrl-run-step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--v5-font-mono);
  font-size: .6rem;
  font-weight: 800;
}
.ctrl-run-step-ico {
  width: 22px; height: 22px;
  border-radius: 6px;
  display: grid; place-items: center;
  font-size: .8rem;
}
.ctrl-run-step-status {
  font-family: var(--v5-font-mono);
  font-size: .58rem;
  color: var(--v5-text-muted);
  min-width: 70px;
  text-align: right;
}
.ctrl-run-step-status.is-active {
  color: rgb(0, 154, 150);
  font-weight: 700;
}
.dark .ctrl-run-step-status.is-active { color: rgb(var(--v5-cyan-rgb)); }

/* Latency bar */
.ctrl-latency-bar {
  display: inline-flex; align-items: center;
  gap: 6px;
  width: 70px;
  height: 5px;
  background: var(--v5-bg-subtle);
  border-radius: 999px;
  position: relative; overflow: visible;
}
.ctrl-latency-bar > div {
  height: 100%;
  border-radius: 999px;
  transition: width .3s var(--v5-ease-move);
}
.ctrl-latency-bar > span {
  position: absolute;
  right: -42px;
  top: -5px;
  font-family: var(--v5-font-mono);
  font-size: .56rem;
  color: var(--v5-text-muted);
  font-weight: 700;
}

/* ─── History mode ─── */
.ctrl-history-shell {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
}
.ctrl-history-top {
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--v5-border);
  display: flex; align-items: center;
  gap: 14px;
}
.ctrl-history-tag {
  display: inline-flex; align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--v5-bg-subtle);
  border: 1px solid var(--v5-border);
  font-family: var(--v5-font-mono);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--v5-text-sec);
}
.ctrl-history-select {
  height: 26px;
  padding: 0 .4rem;
  background: var(--v5-surface-solid);
  border: 1px solid var(--v5-border);
  border-radius: 5px;
  font-family: inherit;
  font-size: .66rem;
  color: var(--v5-text);
}
.ctrl-history-body {
  flex: 1; overflow: auto;
}
.ctrl-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .7rem;
}
.ctrl-history-table thead th {
  padding: .55rem .85rem;
  text-align: left;
  font-family: var(--v5-font-mono);
  font-size: .54rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--v5-text-muted);
  background: var(--v5-bg-subtle);
  border-bottom: 1px solid var(--v5-border);
  position: sticky; top: 0;
  z-index: 1;
}
.ctrl-history-table tbody td {
  padding: .55rem .85rem;
  border-bottom: 1px solid var(--v5-border-subtle);
  vertical-align: middle;
}
.ctrl-history-mono {
  font-family: var(--v5-font-mono);
  font-size: .66rem;
  font-weight: 600;
  color: var(--v5-text);
}
.ctrl-history-sec { color: var(--v5-text-sec) !important; }
.ctrl-history-dot {
  width: 7px; height: 7px;
  display: inline-block;
  border-radius: 50%;
}
.ctrl-history-result {
  padding: 1.5px 8px;
  border-radius: 999px;
  font-family: var(--v5-font-mono);
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.ctrl-history-result.ok {
  background: rgba(var(--v5-green-rgb), .1);
  color: var(--v5-green);
}
.ctrl-history-result.fail {
  background: rgba(var(--v5-red-rgb), .1);
  color: var(--v5-red);
}
.ctrl-history-more {
  width: 22px; height: 22px;
  border: none;
  background: transparent;
  border-radius: 5px;
  cursor: pointer;
  color: var(--v5-text-muted);
}
.ctrl-history-more:hover {
  background: var(--v5-surface-hover);
  color: var(--v5-text);
}

/* ─── StatusBar ─── */
.ctrl-ide-statusbar code {
  font-family: var(--v5-font-mono);
  font-size: .62rem;
  color: var(--v5-text);
  font-weight: 700;
}
.ctrl-ide-statusbar b {
  font-family: var(--v5-font-mono);
  font-size: .55rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--v5-text-muted);
  margin-right: 4px;
}
.ctrl-ide-status-ok {
  color: var(--v5-green);
  font-family: var(--v5-font-mono);
  font-size: .6rem;
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LeftRail v2 — v3 V3LeftRail + invyone 테이블 팔레트 통합
   ═══════════════════════════════════════════════════════════════════════════ */

/* 검색 박스 */
.ctrl-rail-search {
  display: flex; align-items: center; gap: 5px;
  margin: 8px 8px 6px;
  padding: 5px 8px;
  background: var(--v5-bg-subtle);
  border: 1px solid var(--v5-border);
  border-radius: 6px;
  color: var(--v5-text-muted);
  flex-shrink: 0;
}
.ctrl-rail-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: .68rem;
  color: var(--v5-text);
}
.ctrl-rail-search input::placeholder { color: var(--v5-text-muted); }

/* 섹션 — V3RailSection 미러 */
.ctrl-rail-sec {
  display: flex; flex-direction: column;
  flex: 0 0 auto;
  min-height: 0;
  border-bottom: 1px solid var(--v5-border-subtle);
}
.ctrl-rail-sec.expand { flex: 1 1 0; }
.ctrl-rail-sec-head {
  padding: .55rem .7rem;
  display: flex; align-items: center; gap: 6px;
  background: var(--v5-bg-subtle);
  font-family: var(--v5-font-mono);
  font-size: .58rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--v5-text-sec);
  flex-shrink: 0;
}
.ctrl-rail-sec-title { flex: 1; }
.ctrl-rail-sec-count { color: var(--v5-text-muted); }
.ctrl-rail-sec-body {
  overflow: auto;
  flex: 1; min-height: 0;
}

/* 카드 목록 */
.ctrl-rail-cards {
  padding: 5px 7px;
  display: flex; flex-direction: column;
  gap: 3px;
}
.ctrl-rail-card {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
  transition: background .15s var(--v5-ease-move), border-color .15s var(--v5-ease-move);
}
.ctrl-rail-card:hover { background: var(--v5-surface-hover); }
.ctrl-rail-card.on {
  background: rgba(var(--v5-cyan-rgb), .12);
  border-color: rgba(var(--v5-cyan-rgb), .35);
}
.ctrl-rail-card-ico {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--v5-bg-subtle);
  color: var(--v5-text-sec);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.ctrl-rail-card.on .ctrl-rail-card-ico {
  background: rgba(var(--v5-cyan-rgb), .2);
  color: rgb(0, 154, 150);
}
.dark .ctrl-rail-card.on .ctrl-rail-card-ico { color: rgb(var(--v5-cyan-rgb)); }
.ctrl-rail-card-body { flex: 1; min-width: 0; }
.ctrl-rail-card-title {
  font-size: .72rem; font-weight: 600;
  color: var(--v5-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ctrl-rail-card-tbl {
  font-family: var(--v5-font-mono);
  font-size: .58rem;
  color: var(--v5-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ctrl-rail-card-chev { color: rgb(0, 154, 150); flex-shrink: 0; }
.dark .ctrl-rail-card-chev { color: rgb(var(--v5-cyan-rgb)); }

/* 카테고리 라벨 — v3 V3LeftRail 미러 (mono uppercase + dot) */
.ctrl-rail-cat-label {
  display: flex; align-items: center; gap: 5px;
  margin-bottom: 4px;
  padding: 0 2px;
  font-family: var(--v5-font-mono);
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.ctrl-rail-cat-dot {
  width: 6px; height: 6px;
  border-radius: 2px;
}
.ctrl-rail-cat-count {
  color: var(--v5-text-muted);
  font-weight: 500;
}
.ctrl-rec-label { color: var(--v5-amber); }

/* 테이블 — invyone 기존 디자인 유지 */
.ctrl-rail-tbls-wrap {
  padding: 6px 7px;
}
.ctrl-rail-tbls-others { padding-top: 0; }
.ctrl-rail-tbls {
  display: flex; flex-direction: column;
  gap: 3px;
}
.ctrl-rail-tbl {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 7px;
  background: var(--v5-surface-solid);
  border: 1px solid var(--v5-border);
  border-radius: 6px;
  cursor: grab;
  position: relative;
  transition: background .15s var(--v5-ease-move),
              border-color .15s var(--v5-ease-move);
}
.ctrl-rail-tbl:hover {
  background: var(--v5-surface-hover);
  border-color: rgba(var(--v5-cyan-rgb), .35);
}
.ctrl-rail-tbl:active { cursor: grabbing; }
.ctrl-rail-tbl.rec {
  border-color: rgba(var(--v5-amber-rgb), .35);
  background: rgba(var(--v5-amber-rgb), .04);
}
.ctrl-rail-tbl-ico {
  font-size: .85rem;
  width: 16px; text-align: center;
  flex-shrink: 0;
}
.ctrl-rail-tbl-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.ctrl-rail-tbl-label {
  font-size: .65rem;
  font-weight: 600;
  color: var(--v5-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ctrl-rail-tbl-sub {
  font-family: var(--v5-font-mono);
  font-size: .53rem;
  color: var(--v5-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ctrl-rail-tbl-star {
  color: var(--v5-amber);
  fill: var(--v5-amber);
  flex-shrink: 0;
}

/* 노드 팔레트 */
.ctrl-rail-nodes {
  padding: 6px 7px;
}
.ctrl-rail-nodecat {
  margin-bottom: 10px;
}
.ctrl-rail-nodes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
}
.ctrl-rail-node {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 6px;
  background: var(--v5-surface-solid);
  border: 1px solid var(--v5-border);
  border-radius: 6px;
  cursor: grab;
  font-family: inherit;
  font-size: .6rem; font-weight: 600;
  color: var(--v5-text);
  text-align: left;
  transition: background .15s var(--v5-ease-move),
              border-color .15s var(--v5-ease-move),
              transform .12s var(--v5-ease-move);
}
.ctrl-rail-node:hover {
  background: var(--v5-surface-hover);
  border-color: rgba(var(--v5-cyan-rgb), .35);
  transform: translateY(-1px);
}
.ctrl-rail-node:active { cursor: grabbing; }
.ctrl-rail-node-ico {
  font-size: .75rem;
  width: 14px; text-align: center;
  flex-shrink: 0;
}
.ctrl-rail-node-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctrl-rail-empty {
  padding: .6rem .5rem;
  font-size: .62rem;
  color: var(--v5-text-muted);
  text-align: center;
  font-style: italic;
}

.ctrl-rail-hint {
  margin: 12px;
  padding: 10px 12px;
  background: var(--v5-bg-subtle);
  border: 1px dashed var(--v5-border);
  border-radius: 7px;
  display: flex; align-items: center;
  gap: 8px;
  font-size: .65rem;
  color: var(--v5-text-muted);
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════════════════
   V3RuleNode — v3-canvas.jsx V3RuleNode 정확 포팅 (cat-stripe + validation dot + comment + cat-chip + label + summary + stats + ports)
   ═══════════════════════════════════════════════════════════════════════════ */
.v3-rule-node {
  position: absolute;
  width: 150px;
  background: var(--v5-surface-solid);
  border: 1.5px solid;
  border-radius: 9px;
  cursor: grab;
  overflow: visible;
  user-select: none;
  touch-action: none;
  pointer-events: auto;
  transition: opacity .15s var(--v5-ease-move),
              box-shadow .2s var(--v5-ease-move),
              border-color .2s var(--v5-ease-move);
}
/* 자식 (stripe / vdot / comment / body / port) 가 pointer 이벤트 안 흡수 — V3RuleNode div 가 받음 */
.v3-rule-node-stripe,
.v3-rule-node-vdot,
.v3-rule-node-comment,
.v3-rule-node-body,
.v3-rule-node-port { pointer-events: none; }
.v3-rule-node:active { cursor: grabbing; }
.v3-rule-node.is-dim { opacity: .4; }
.v3-rule-node-stripe {
  height: 3px;
  opacity: .9;
  border-radius: 9px 9px 0 0;
}
.v3-rule-node-vdot {
  position: absolute;
  top: -4px; right: -4px;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid var(--v5-surface-solid);
}
.v3-rule-node-comment {
  position: absolute;
  top: -7px; left: -6px;
  z-index: 3;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: .55rem;
  font-weight: 700;
  border: 2px solid var(--v5-surface-solid);
}
.v3-rule-node-body { padding: .45rem .6rem .5rem; }
.v3-rule-node-cat {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
}
.v3-rule-node-cat-ico {
  width: 20px; height: 20px;
  border-radius: 5px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.v3-rule-node-cat-label {
  font-size: .53rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  font-family: var(--v5-font-mono);
}
.v3-rule-node-label {
  font-size: .73rem;
  font-weight: 700;
  color: var(--v5-text);
  letter-spacing: -.01em;
  margin-bottom: 3px;
}
.v3-rule-node-summary {
  font-family: var(--v5-font-mono);
  font-size: .55rem;
  color: var(--v5-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.v3-rule-node-stats {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--v5-border);
  display: flex;
  justify-content: space-between;
  font-family: var(--v5-font-mono);
  font-size: .5rem;
  color: var(--v5-text-muted);
}
.v3-rule-node-port {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  top: 24px;
}
.v3-rule-node-port-in {
  left: -4px;
  background: var(--v5-surface-solid);
  border-width: 1.5px;
  border-style: solid;
}
.v3-rule-node-port-out {
  right: -4px;
}

/* ─── EditCanvas title chip ─── */
.v3-edit-title-chip {
  position: absolute;
  top: 14px; left: 14px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px;
  background: var(--v5-surface-solid);
  border: 1px solid var(--v5-border);
  border-radius: 7px;
  font-size: .7rem;
  font-weight: 700;
  color: var(--v5-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  z-index: 5;
}
.v3-edit-title-ver {
  font-family: var(--v5-font-mono);
  font-size: .6rem;
  color: var(--v5-text-muted);
  margin-left: 4px;
}

/* ─── Context Menu (우클릭) ─── */
.v3-ctxmenu {
  position: absolute;
  background: var(--v5-surface-solid);
  border: 1px solid var(--v5-border);
  border-radius: 8px;
  box-shadow:
    0 12px 28px -8px rgba(0, 0, 0, .18),
    0 2px 4px rgba(0, 0, 0, .04);
  min-width: 180px;
  padding: 4px;
  z-index: 30;
}
.v3-ctxmenu-item {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px;
  border: none;
  background: transparent;
  border-radius: 5px;
  font-family: inherit;
  font-size: .7rem;
  font-weight: 500;
  color: var(--v5-text);
  cursor: pointer;
  text-align: left;
  transition: background .15s var(--v5-ease-move);
}
.v3-ctxmenu-item svg { color: var(--v5-text-sec); flex-shrink: 0; }
.v3-ctxmenu-item:hover { background: var(--v5-surface-hover); }
.v3-ctxmenu-item.danger { color: var(--v5-red); }
.v3-ctxmenu-item.danger svg { color: var(--v5-red); }
.v3-ctxmenu-sep {
  height: 1px;
  background: var(--v5-border);
  margin: 4px 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ContextBar Presence Stack
   ═══════════════════════════════════════════════════════════════════════════ */
.ctrl-presence {
  display: inline-flex; align-items: center;
  margin-right: 4px;
}
.ctrl-presence-avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--v5-surface-solid);
  margin-left: -6px;
  display: grid; place-items: center;
  color: #fff;
  font-size: .55rem;
  font-weight: 700;
  position: relative;
}
.ctrl-presence-avatar:first-child { margin-left: 0; }
.ctrl-presence-avatar.is-edit::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--v5-green);
  border: 1.5px solid var(--v5-surface-solid);
}
.ctrl-presence-more {
  width: 20px; height: 20px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--v5-bg-subtle);
  border: 2px solid var(--v5-surface-solid);
  color: var(--v5-text-sec);
  display: grid; place-items: center;
  font-family: var(--v5-font-mono);
  font-size: .52rem;
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RightRail Activity Section (실행 상태 · live)
   ═══════════════════════════════════════════════════════════════════════════ */
.ctrl-activity {
  padding: .65rem .7rem;
  display: flex; flex-direction: column;
  gap: 7px;
}
.ctrl-activity-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 8px;
  background: var(--v5-bg-subtle);
  border-radius: 5px;
}
.ctrl-activity-label {
  font-family: var(--v5-font-mono);
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--v5-text-muted);
}
.ctrl-activity-value {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .68rem;
  font-weight: 600;
  color: var(--v5-text);
}
.ctrl-activity-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}
.ctrl-activity-dot.ok { background: var(--v5-green); box-shadow: 0 0 5px var(--v5-green); }
.ctrl-activity-dot.warn { background: var(--v5-amber); box-shadow: 0 0 5px var(--v5-amber); }
.ctrl-activity-dot.bad { background: var(--v5-red);   box-shadow: 0 0 5px var(--v5-red); }

/* ═══════════════════════════════════════════════════════════════════════════
   StatusBar v2 — v3 V3StatusBar 미러 (Workflow icon + RULE_NAME + 진행 dot + 라텐시 + 최근 실행)
   ═══════════════════════════════════════════════════════════════════════════ */
.ctrl-status-rule {
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 700;
  color: var(--v5-text);
  font-family: var(--v5-font-sans);
  font-size: .68rem;
}
.ctrl-status-ver {
  font-family: var(--v5-font-mono);
  font-size: .55rem;
  color: var(--v5-text-muted);
}
.ctrl-status-pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--v5-green);
  box-shadow: 0 0 6px var(--v5-green);
  animation: ctrl-fab-pulse 1.4s infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════
   헤더 아래 cyan flash glow — v3 .dh-glow.on 미러
   ═══════════════════════════════════════════════════════════════════════════ */
.v5-hdr::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgb(var(--v5-cyan-rgb)),
    rgb(var(--v5-green-rgb)),
    rgb(var(--v5-cyan-rgb)),
    transparent);
  opacity: 0;
  transition: opacity .4s var(--v5-ease-move);
  pointer-events: none;
}
body:has(.ud-htool[data-mode="ctrl"].on) .v5-hdr::after {
  opacity: 1;
  animation: ctrl-dh-glow-pulse 2.4s ease-in-out infinite;
}
@keyframes ctrl-dh-glow-pulse {
  0%, 100% { opacity: .4; }
  50%      { opacity: 1; }
}
