/* CityFlow — S2 파이프라인 화면(목록 + 캔버스 에디터)
   소유: S2 워커 */

/* ══════════════ 루트 ══════════════ */
.editor-root { min-height: 100%; }

/* 화면 전용 클래스가 display를 지정하므로 hidden 속성을 명시적으로 우선시킨다 */
.editor-root [hidden] { display: none !important; }

/* 폼 요소 (패널 공용) */
.editor-input,
.editor-select {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  font-size: var(--fs-sm);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--t-micro), box-shadow var(--t-micro);
}
.editor-input::placeholder { color: var(--text-faint); }
.editor-input:hover,
.editor-select:hover { border-color: var(--border-strong); }
.editor-input:focus,
.editor-select:focus { border-color: var(--border-accent); box-shadow: var(--glow-accent-soft); }
.editor-select { padding-right: 6px; }

/* ══════════════ 목록 뷰 ══════════════ */
.editor-list {
  position: relative;
  /* 하단 페이드 마스크에 마지막 행이 잠기지 않도록 여유를 둔다 */
  padding: var(--sp-6) var(--sp-6) 96px;
}

/* 화면 하단에서 카드가 잘려 보이지 않도록 배경색으로 소멸하는 마스크 */
.editor-list::after {
  content: "";
  position: fixed;
  left: var(--rail-w);
  right: 0;
  bottom: 0;
  height: 84px;
  background: linear-gradient(to top, var(--bg) 22%, transparent);
  pointer-events: none;
}

.editor-listhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-5);
}
.editor-listhead__title {
  font-size: var(--fs-h1);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.editor-listhead__sub {
  margin-top: 4px;
  font-size: var(--fs-body);
  color: var(--text-dim);
}
.editor-listhead__sub b { color: var(--text); font-weight: 500; }
.editor-listhead__sub .cf-num { color: var(--text); }

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin: var(--sp-5) 0 var(--sp-4);
}

.editor-filters { display: flex; gap: var(--sp-2); }

.editor-search {
  position: relative;
  flex: 0 0 auto;
  width: 260px;
  color: var(--text-faint);
}
.editor-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 15px;
  height: 15px;
  margin-top: -7.5px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.editor-search__input {
  width: 100%;
  height: 32px;
  padding: 0 11px 0 32px;
  font-size: var(--fs-sm);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: border-color var(--t-micro), box-shadow var(--t-micro);
}
.editor-search__input::placeholder { color: var(--text-faint); }
.editor-search__input:hover { border-color: var(--border-strong); }
.editor-search__input:focus { border-color: var(--border-accent); box-shadow: var(--glow-accent-soft); }

.editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: var(--sp-4);
}

/* 파이프라인 카드 */
.editor-card {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  padding: var(--sp-4) var(--sp-4) var(--sp-3) calc(var(--sp-4) + 3px);
  text-align: left;
  cursor: pointer;
  animation: editor-card-in var(--dur-enter) var(--ease-enter) both;
}
.editor-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--cf-color, var(--border-strong));
  opacity: 0.85;
}
.editor-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}
.editor-card__name {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.editor-card__meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  font-size: var(--fs-sm);
  color: var(--text-dim);
}
.editor-card__cat {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cf-color, var(--text-faint));
}
.editor-card__kind {
  padding: 1px 7px;
  font-size: var(--fs-xs);
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}
.editor-card__spark {
  display: block;
  margin: var(--sp-3) 0 var(--sp-2);
  height: 36px;
  color: var(--cf-color, var(--text-faint));
}
.editor-card__spark svg { width: 100%; height: 36px; }
.editor-card__spark .line {
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.editor-card__spark .area { fill: currentColor; opacity: 0.1; stroke: none; }
.editor-card.is-idle .editor-card__spark { color: var(--text-faint); }

.editor-card__foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.editor-card__rate { font-size: var(--fs-sm); color: var(--text-dim); }
.editor-card__rate .cf-num {
  font-size: var(--fs-h3);
  font-weight: 500;
  color: var(--text);
  margin-right: 3px;
}
.editor-card__today { font-size: var(--fs-xs); color: var(--text-faint); }

@keyframes editor-card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.editor-empty {
  padding: var(--sp-7) 0;
  text-align: center;
  color: var(--text-faint);
}

/* ══════════════ 에디터 뷰 ══════════════ */
.editor-stage {
  display: grid;
  grid-template-rows: 60px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.editor-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.editor-bar__sep {
  width: 1px;
  height: 20px;
  background: var(--border);
}
.editor-bar__name {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.editor-bar__spacer { flex: 1 1 auto; }

/* 실행 버튼 — 상태와 아이콘을 일치시킨다 */
.editor-runbtn .editor-runbtn__stop { display: none; }
.editor-runbtn.is-running .editor-runbtn__play { display: none; }
.editor-runbtn.is-running .editor-runbtn__stop { display: block; }
/* 정지 아이콘은 외곽선이 아닌 채운 사각형 */
.editor-runbtn__stop path { fill: currentColor; stroke: none; }

.editor-goto {
  gap: 8px;
  height: 30px;
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--border-accent);
  animation: editor-goto-in var(--dur-enter) var(--ease-enter) both;
}
.editor-goto:hover { color: var(--accent); box-shadow: var(--glow-accent-soft); }
@keyframes editor-goto-in {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: none; }
}

/* 본문 3열 — 패널이 열리면 캔버스 폭이 줄어든다 */
.editor-body {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 0px;
  min-height: 0;
  transition: grid-template-columns var(--t-enter);
}
.editor-body.is-panel { grid-template-columns: 264px minmax(0, 1fr) 440px; }

/* ── 좌측 팔레트 ── */
.editor-palette {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-3);
  overflow: auto;
  border-right: 1px solid var(--border);
  background: var(--surface);
  transform: translateX(-12px);
  opacity: 0;
  transition: transform var(--t-enter), opacity var(--t-enter);
}
.editor-palette.is-in { transform: none; opacity: 1; }

.editor-palgroup__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-2) var(--sp-2);
}
.editor-palgroup__count { font-size: var(--fs-xs); color: var(--text-faint); }
.editor-palgroup__list { display: flex; flex-direction: column; gap: 4px; }

.editor-palitem {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 10px;
  text-align: left;
  font-size: var(--fs-sm);
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  /* 가로 끌기는 노드 생성 드래그로, 세로는 팔레트 스크롤로 넘긴다 */
  touch-action: pan-y;
  transition: color var(--t-micro), background-color var(--t-micro), border-color var(--t-micro), transform var(--t-micro);
}
.editor-palitem__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.editor-palitem__icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.editor-palitem__name { flex: 1 1 auto; min-width: 0; }
.editor-palitem__badge {
  flex: 0 0 auto;
  padding: 1px 6px;
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-pill);
}
.editor-palitem:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
  transform: translateY(-2px);
}
.editor-palitem:hover .editor-palitem__icon { border-color: var(--border-strong); }


/* ── 캔버스 ── */
.editor-stagewrap {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.editor-canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  background-color: var(--bg-deep);
  background-image: radial-gradient(circle at 1px 1px, var(--border-strong) 1px, transparent 1.4px);
  background-size: 16px 16px;
}
.editor-canvas.is-panning { cursor: grabbing; }

.editor-canvas__hint {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: var(--fs-sm);
  line-height: 1.8;
  color: var(--text-faint);
  pointer-events: none;
  transition: opacity var(--t-enter);
}
.editor-canvas.has-node ~ .editor-canvas__hint { opacity: 0; }

/* 우하단 배율 컨트롤 */
.editor-zoom {
  position: absolute;
  right: var(--sp-4);
  bottom: calc(var(--sp-4) + 34px);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--surface-glass-strong);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(10px);
  transition: bottom var(--t-enter);
}
.editor-stagewrap.is-logs-open .editor-zoom { bottom: calc(var(--sp-4) + 200px); }
.editor-zoom__btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  transition: color var(--t-micro), background-color var(--t-micro);
}
.editor-zoom__btn svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.editor-zoom__btn:hover { color: var(--text); background: var(--surface-2); }
.editor-zoom__val {
  min-width: 46px;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--text-dim);
}
.editor-zoom__sep { width: 1px; height: 18px; margin: 0 3px; background: var(--border); }

/* 하단 실행 로그 드로어 */
.editor-logs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface-glass-strong);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.editor-logs__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  height: 34px;
  padding: 0 var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--text-dim);
  transition: color var(--t-micro), background-color var(--t-micro);
}
.editor-logs__head:hover { color: var(--text); background: var(--surface-2); }
.editor-logs__chev {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--t-micro);
}
.editor-logs.is-open .editor-logs__chev { transform: rotate(180deg); }
.editor-logs__title { font-weight: 500; }
.editor-logs__meta { margin-left: auto; font-size: var(--fs-xs); color: var(--text-faint); }

.editor-logs__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--t-enter);
}
.editor-logs.is-open .editor-logs__body { max-height: 176px; }

.editor-logline {
  display: grid;
  grid-template-columns: 88px 1fr 92px 68px;
  gap: var(--sp-3);
  align-items: center;
  padding: 7px var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}
.editor-logline__time { color: var(--text-faint); }
.editor-logline__msg { color: var(--text); }
.editor-logline__count { text-align: right; }
.editor-logline__state { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }

.editor-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.editor-wire {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 2;
  stroke-linecap: round;
  transition: stroke var(--t-enter);
}
.editor-wire--live { stroke: var(--st-running); opacity: 0.55; }
.editor-wire--ghost { stroke: var(--accent-line); stroke-dasharray: 5 6; }
.editor-wire--draft { opacity: 0; stroke: var(--accent); stroke-dasharray: 4 6; }
.editor-wire--draft.is-on { opacity: 0.9; }

/* 엣지 클릭 판정용 투명 두꺼운 선 */
.editor-wires__edges { pointer-events: auto; }
.editor-wire__hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  pointer-events: stroke;
  cursor: pointer;
}
.editor-wire { pointer-events: none; }
.editor-edge:hover .editor-wire { stroke: var(--text-faint); }
.editor-edge.is-selected .editor-wire { stroke: var(--accent); stroke-width: 2.4; }

/* 선택된 엣지의 해제 버튼 */
.editor-edgex {
  position: absolute;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  pointer-events: auto;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-accent);
  border-radius: 50%;
  box-shadow: var(--glow-accent-soft);
  transition: color var(--t-micro), border-color var(--t-micro);
}
.editor-edgex svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.editor-edgex:hover { color: var(--st-error); border-color: var(--st-error); }

.editor-particle { fill: var(--st-running); }
.editor-particle__halo { fill: var(--st-running); opacity: 0.22; }

.editor-nodes {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  pointer-events: none;
}

/* 노드 카드 */
.editor-node {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 216px;
  height: 66px;
  padding: 0 12px 0 13px;
  pointer-events: auto;
  cursor: grab;
  background: var(--surface-glass-strong);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  animation: editor-node-in var(--dur-enter) var(--ease-enter) both;
  transition: border-color var(--t-micro), box-shadow var(--t-micro);
}
.editor-node:active { cursor: grabbing; }
.editor-node__strip {
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--cf-color, var(--border-strong));
}
.editor-node__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: var(--cf-color, var(--text-dim));
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.editor-node__icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.editor-node__body { min-width: 0; flex: 1 1 auto; }
.editor-node__name {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.editor-node__kind {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.editor-node__dot { flex: 0 0 auto; }
.editor-node__badge {
  position: absolute;
  right: -6px;
  top: -10px;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 2px 8px;
  font-size: var(--fs-xs);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  transition: opacity var(--t-micro);
}
/* 수치 배지의 의미 라벨 — 등폭 수치와 구분되게 본문 서체로 */
.editor-node__badge-k {
  font-family: var(--font-sans);
  color: var(--text-faint);
}
/* 노드 삭제 버튼 — hover 시 배지 자리를 대신한다 */
.editor-node__del {
  position: absolute;
  right: -9px;
  top: -9px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  opacity: 0;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  transition: opacity var(--t-micro), color var(--t-micro), border-color var(--t-micro);
}
.editor-node__del svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.editor-node:hover .editor-node__del,
.editor-node:focus-within .editor-node__del { opacity: 1; }
.editor-node:hover .editor-node__badge,
.editor-node:focus-within .editor-node__badge { opacity: 0; }
.editor-node__del:hover { color: var(--st-error); border-color: var(--st-error); }

/* 시각 채널 분리 — 상태는 테두리 색, 선택은 오프셋 글로우 링 */
.editor-node.is-live { border-color: var(--st-running); }
.editor-node.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: var(--glow-accent-soft);
}

/* 연결점 */
.editor-port {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  transition: transform var(--t-micro), background-color var(--t-micro), border-color var(--t-micro);
}
.editor-port--in { left: -6px; }
.editor-port--out { right: -6px; cursor: crosshair; }
.editor-node:hover .editor-port { border-color: var(--accent-line); }
/* 연결 드래그 중 — 유효 대상은 은은하게, 흡착 대상은 강하게 */
.editor-port.is-candidate {
  background: var(--accent-soft);
  border-color: var(--border-accent);
}
.editor-port.is-magnet {
  transform: scale(1.45);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--glow-accent-soft);
}

/* 고스트 제안 노드 */
.editor-node--ghost {
  cursor: pointer;
  background: var(--surface-glass);
  border-style: dashed;
  border-color: var(--border-accent);
  opacity: 0.72;
  transition: opacity var(--t-micro), transform var(--t-micro), box-shadow var(--t-micro);
}
.editor-node--ghost:hover { opacity: 1; transform: scale(1.02); box-shadow: var(--glow-accent-soft); }
.editor-node--ghost .editor-node__icon { color: var(--accent); }
.editor-node__suggest {
  position: absolute;
  left: 0;
  top: -22px;
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--accent);
}

@keyframes editor-node-in {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ── 우측 속성 패널 ── */
.editor-panel {
  overflow: hidden;
  border-left: 1px solid var(--border);
  background: var(--surface);
  visibility: hidden;
  transition: visibility var(--dur-enter);
}
.editor-body.is-panel .editor-panel { visibility: visible; }

.editor-panel__inner {
  display: flex;
  flex-direction: column;
  width: 440px;
  height: 100%;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity var(--t-enter), transform var(--t-enter);
}
.editor-body.is-panel .editor-panel__inner { opacity: 1; transform: none; }

/* 헤더 고정 · 본문 스크롤 · 액션 바 고정 */
.editor-panel__scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  overflow: auto;
}
.editor-panel__bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.editor-panel__bar-gap { flex: 1 1 auto; }

/* 위험 동작 — 보더로만 경고색을 쓴다 */
.editor-btn-danger {
  color: var(--st-error);
  border-color: var(--st-error);
  background: transparent;
}
.editor-btn-danger:hover { background: var(--surface-2); border-color: var(--st-error); }

.editor-form { display: flex; flex-direction: column; gap: var(--sp-4); }

.editor-panel__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.editor-panel__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  color: var(--cf-color, var(--text-dim));
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.editor-panel__icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.editor-panel__titles { flex: 1 1 auto; min-width: 0; }
.editor-panel__title {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.editor-field { display: flex; flex-direction: column; gap: 6px; }
.editor-field__label {
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.editor-field__note { font-size: var(--fs-xs); color: var(--text-faint); }
.editor-fieldrow2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }

.editor-panel__actions { display: flex; gap: var(--sp-2); }

/* 연결 확인 결과 */
.editor-probe { min-height: 0; }
.editor-probe__bar {
  height: 4px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
}
.editor-probe__bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
}
.editor-probe__msg {
  margin-top: 8px;
  font-size: var(--fs-sm);
  color: var(--text-dim);
}

.editor-probe__panel { animation: editor-probe-in var(--dur-enter) var(--ease-enter) both; }
@keyframes editor-probe-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.editor-probe__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.editor-probe__ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--st-running);
}
.editor-probe__ok svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.editor-probe__json {
  max-height: 168px;
  margin: 0 0 var(--sp-4);
  padding: var(--sp-3);
  overflow: auto;
  font-size: var(--fs-xs);
  line-height: 1.7;
  color: var(--text-dim);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: pre;
}
.editor-probe__json b { color: var(--text); font-weight: 400; }

.editor-fields { display: flex; flex-direction: column; gap: 4px; margin-top: var(--sp-2); }
.editor-fieldline {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  font-size: var(--fs-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  opacity: 0;
  transform: translateY(5px);
  transition: opacity var(--t-enter), transform var(--t-enter);
}
.editor-fieldline.is-on { opacity: 1; transform: none; }
.editor-fieldline__check {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--st-running);
}
.editor-fieldline__check svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.editor-fieldline__name { flex: 0 0 auto; color: var(--text); }
.editor-fieldline__type {
  flex: 0 0 auto;
  padding: 0 6px;
  font-size: var(--fs-xs);
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}
.editor-fieldline__val {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  font-size: var(--fs-xs);
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 팔레트 드래그 프리뷰 — 커서를 따라다니는 고스트 카드 */
.editor-dragpreview {
  position: fixed;
  left: 0;
  top: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface-glass-strong);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  transition: color var(--t-micro), border-color var(--t-micro);
}
.editor-dragpreview.is-over {
  color: var(--text);
  border-style: solid;
  border-color: var(--border-accent);
  box-shadow: var(--glow-accent-soft);
}
.editor-dragpreview__icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: inherit;
}
.editor-dragpreview__icon svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ── 저장·변환 폼 요소 ── */

/* 변경 불가한 고정 값 표기 */
.editor-fixed {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  height: 36px;
  padding: 0 11px;
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 36px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.editor-fixed em {
  font-style: normal;
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--text-faint);
}

/* 대상 데이터모델 표시 */
.editor-modelbox {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}
.editor-modelbox.is-auto { border-style: dashed; }
.editor-modelbox__cap {
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--accent);
}
.editor-modelbox__name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}

/* ── 컴포넌트 관리 모달 ── */
.editor-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: grid;
  place-items: center;
}
.editor-modal__scrim {
  position: absolute;
  inset: 0;
  background: var(--overlay-scrim);
  backdrop-filter: blur(3px);
}
.editor-modal__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 620px;
  max-width: calc(100vw - 96px);
  max-height: 76vh;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  animation: editor-modal-in var(--dur-enter) var(--ease-enter) both;
}
@keyframes editor-modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.editor-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.editor-modal__title { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.01em; }
.editor-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: var(--sp-4) var(--sp-5);
}
.editor-modal__foot {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
}
.editor-modal__note { flex: 1 1 auto; font-size: var(--fs-xs); color: var(--text-faint); }

/* 컴포넌트 목록 */
.editor-comps,
.editor-libs { display: flex; flex-direction: column; gap: 6px; }
.editor-comp,
.editor-lib {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.editor-lib { align-items: flex-start; }
.editor-comp__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.editor-comp__icon svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.editor-comp__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.editor-comp__name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.editor-comp__meta,
.editor-comp__desc { font-size: var(--fs-xs); color: var(--text-dim); }
.editor-comp__lock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  font-size: var(--fs-xs);
  color: var(--text-faint);
}
.editor-comp__lock svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.editor-comp__act { display: flex; gap: 5px; flex: 0 0 auto; align-items: center; }
.editor-comp__ask { font-size: var(--fs-xs); color: var(--st-error); }

.editor-lib__preset {
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--accent);
}
.editor-lib__kind {
  margin-left: 7px;
  padding: 1px 6px;
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}
/* 미리 설정된 항목 미리보기 */
.editor-lib__cfgs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-top: 6px;
}
.editor-lib__cfg {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 2px 7px;
  font-size: var(--fs-xs);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.editor-lib__cfg em { font-style: normal; color: var(--text-faint); }
.editor-lib__cfg b {
  font-weight: 400;
  color: var(--text-dim);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-lib.is-added { opacity: 0.6; }
.editor-compedit { display: flex; flex-direction: column; gap: var(--sp-4); }

/* 팔레트 — 추가된 컴포넌트 표시 */
.editor-palitem.is-added .editor-palitem__icon { border-color: var(--border-accent); }
.editor-palitem.is-added::after {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
}

/* 카드형 선택 — 아이콘 + 이름 + 한 줄 설명 */
.editor-choice { display: flex; flex-direction: column; gap: 6px; }
.editor-choice__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--t-micro), background-color var(--t-micro);
}
.editor-choice__item input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.editor-choice__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: color var(--t-micro), border-color var(--t-micro);
}
.editor-choice__icon svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.editor-choice__body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.editor-choice__name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.editor-choice__desc { font-size: var(--fs-xs); color: var(--text-dim); }
.editor-choice__item:hover { border-color: var(--border-strong); }
.editor-choice__item.is-on {
  border-color: var(--border-accent);
  background: var(--accent-soft);
}
.editor-choice__item.is-on .editor-choice__icon { color: var(--accent); border-color: var(--border-accent); }
.editor-choice__item:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 요약 한 줄 + 접이식 상세 */
.editor-summary {
  padding: 9px 11px;
  font-size: var(--fs-sm);
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.editor-summary b { color: var(--text); font-weight: 600; }

.editor-more { margin-top: 6px; }
.editor-more > summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
  font-size: var(--fs-sm);
  color: var(--accent);
  cursor: pointer;
  list-style: none;
}
.editor-more > summary::-webkit-details-marker { display: none; }
.editor-more > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--t-micro);
}
.editor-more[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.editor-more > summary:hover { text-decoration: underline; }
.editor-more > *:not(summary) { margin-top: 7px; }

/* 매핑·스키마 표 */
.editor-map {
  width: 100%;
  font-size: var(--fs-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.editor-map th,
.editor-map td {
  padding: 5px 9px;
  text-align: left;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.editor-map thead th {
  border-top: 0;
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-2);
}
.editor-map__arrow { width: 18px; text-align: center; color: var(--text-faint); }
.editor-map__type { color: var(--text-dim); font-size: var(--fs-xs); white-space: nowrap; }
.editor-map__sel { height: 28px; font-size: var(--fs-xs); }
.editor-map tr.is-unmapped td { background: rgba(251, 191, 36, 0.06); }

/* 압축률 막대 — 상단바(.editor-bar)와 이름이 겹치지 않게 별도 클래스를 쓴다 */
.editor-map__ratio { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.editor-map__ratio .cf-num { font-size: var(--fs-xs); color: var(--text-dim); }
.editor-meter {
  display: block;
  flex: 1 1 auto;
  min-width: 46px;
  height: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.editor-meter span { display: block; height: 100%; background: var(--accent); opacity: 0.7; }

/* 상태 태그 */
.editor-tag {
  display: inline-block;
  padding: 1px 7px;
  font-size: var(--fs-xs);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}
.editor-tag.is-ok { color: var(--st-running); border-color: rgba(52, 211, 153, 0.35); }
.editor-tag.is-warn { color: var(--st-warn); border-color: rgba(251, 191, 36, 0.4); }

.editor-warn,
.editor-ok {
  padding: 8px 11px;
  font-size: var(--fs-sm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.editor-warn { color: var(--st-warn); border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.06); }
.editor-warn b { font-weight: 600; }
.editor-ok { color: var(--st-running); border-color: rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.06); }

/* 체크박스 토글 */
.editor-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 11px;
  font-size: var(--fs-sm);
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.editor-toggle input { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }

/* 키별 변환 규칙 행 */
.editor-rules { display: flex; flex-direction: column; gap: 4px; }
.editor-rule {
  display: grid;
  grid-template-columns: 96px 42px 104px 1fr;
  gap: 6px;
  align-items: center;
  padding: 5px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.editor-rule.is-off { opacity: 0.45; }
.editor-rule__key {
  font-size: var(--fs-sm);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.editor-rule__type { font-size: var(--fs-xs); color: var(--text-faint); }
.editor-rule .editor-select { height: 28px; font-size: var(--fs-xs); padding: 0 6px; }
.editor-rule__args { display: flex; gap: 5px; min-width: 0; }
.editor-rule__arg { height: 28px; font-size: var(--fs-xs); padding: 0 7px; min-width: 0; }

/* 입력 → 출력 병치 미리보기 */
.editor-diff { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.editor-diff__cap {
  margin-bottom: 5px;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.editor-diff .editor-probe__json { max-height: 190px; margin: 0; }

/* 패널 섹션 — 샘플 스키마 · 최근 실행 */
.editor-sec { display: flex; flex-direction: column; gap: var(--sp-2); }
.editor-sec__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
}
.editor-sec__meta { font-size: var(--fs-xs); color: var(--text-faint); }

.editor-schema {
  width: 100%;
  font-size: var(--fs-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.editor-schema th,
.editor-schema td {
  padding: 6px 10px;
  text-align: left;
  border-top: 1px solid var(--border);
}
.editor-schema thead th {
  border-top: 0;
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-2);
}
.editor-schema__name { color: var(--text); white-space: nowrap; }
.editor-schema__type { width: 64px; color: var(--text-dim); }
.editor-schema__val {
  color: var(--text-dim);
  text-align: right;
  font-size: var(--fs-xs);
  word-break: break-all;
}

.editor-minilog { display: flex; flex-direction: column; gap: 4px; }
.editor-minilog li {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: var(--sp-2);
  align-items: center;
  padding: 6px 9px;
  font-size: var(--fs-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
}
.editor-minilog .time { color: var(--text-faint); font-size: var(--fs-xs); }
.editor-minilog .count { color: var(--text); }

/* 모션 저감 — 진입 애니 억제(색·상태 표시는 유지) */
@media (prefers-reduced-motion: reduce) {
  .editor-card,
  .editor-node,
  .editor-goto,
  .editor-probe__panel { animation: none; }
  .editor-fieldline { opacity: 1; transform: none; }
}
