/* ===== Tree base ===== */
.stage-tree {
  margin-top: 1rem;
}
.stage-tree__toolbar {
  margin-bottom: 0.5rem;
}
.stage-tree .btn {
  padding: 0.25rem 0.5rem;
  margin-right: 0.25rem;
}

.stree {
  list-style: none;
  margin: 0;
  padding: 0;
}
.stree > .stree-node {
  margin-left: 0;
}

.stree-node {
  position: relative;
  margin: 0.125rem 0 0.125rem 1rem;
}
.stree-node::before {
  content: "";
  position: absolute;
  left: -0.75rem;
  top: 0.8em;
  width: 0.5rem;
  height: 0;
  border-top: 1px solid #ddd;
}
.stree-children {
  list-style: none;
  margin: 0.125rem 0 0 1rem;
  padding-left: 0.75rem;
  border-left: 1px solid #ddd;
  display: none; /* 초기 닫힘 */
}

.stree-toggle {
  cursor: pointer;
  display: inline-block;
  width: 1em;
  text-align: center;
  margin-right: 0.25rem;
  user-select: none;
}
.stree-toggle.leaf {
  visibility: hidden;
}

.icon,
.icon-only:not(.toggle-multiselect) {
  padding-left: 16px;
  background-repeat: no-repeat;
  background-position: 0% 50%;
}

.stree-title {
  user-select: none;
  -webkit-user-drag: none;
}
.stree-title a {
  font-weight: 600;
}
.stree-meta {
  color: #666;
  margin-left: 0.35rem;
  font-size: 90%;
}

/* 드래그 중 링크 클릭 차단 (체감 개선) */
body.stage-dragging .stree-title a {
  pointer-events: none;
}

/* 드래그 중 원본 노드 페이드 */
.stree-node.dragging > .stree-title {
  opacity: 0.6;
}

/* ===== Drop target / candidate highlight ===== */
/* 드롭 포인터 아래(정확한 타깃) – 더 진하게 */
.stree-title.stree-drop-target {
  display: inline-block;
  padding: 2px 4px;
  border-radius: 6px;
}
.stree-title.stree-drop-target.droppable-hover {
  outline: 2px dashed #6b8aff;
  outline-offset: 2px;
}

/* 드래그 시작 시 "드롭 가능한 후보" 전체 – 옅은 강조 (jQuery에서 .droppable-candidate 부여) */
.stree-node.droppable-candidate {
  border: 2px dashed #c6d2ff;
  border-radius: 8px;
  background: #f7f9ff;
}
.stree-node.droppable-candidate > .stree-title {
  outline: 1px dashed #c6d2ff;
  outline-offset: 2px;
}

/* 1단계(루트 단계) 가로 연결선 제거 (stage_idx=0) */
.stree-node[data-stage-idx="0"]::before {
  border-top: 0 !important;
}

/* ===== 2-pane layout (중복 정의 제거하여 1회만 선언) ===== */
.stage-2pane {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.pane-left {
  flex: 1 1 auto;
  min-width: 0;
}
.pane-right {
  flex: 0 0 340px;
  align-self: flex-start;
}

/* ===== Orphans panel ===== */
.stage-orphans {
  position: sticky;
  top: 0;
  max-height: 80vh;
  overflow: auto;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  background: #fff;
}

.stage-orphans__header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}

.stage-orphans__list {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
}

.orphan-item {
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #eee;
  margin: 0.35rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem;
  align-items: center;
  background: #fff;
}
.orphan-item[draggable="true"] {
  cursor: grab;
}
.orphan-item:active {
  cursor: grabbing;
}
.orphan-item .muted {
  color: #777;
  font-size: 90%;
  margin-left: 0.25rem;
}
.orphan-pill {
  display: inline-block;
  font-size: 12px;
  line-height: 1;
  padding: 0.25rem 0.35rem;
  border-radius: 999px;
  background: #eef3ff;
  border: 1px solid #dbe5ff;
}
.orphan-item.dragging {
  opacity: 0.6;
}

/* ===== Modal ===== */
.stage-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
}
.stage-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.stage-modal__dialog {
  position: relative;
  width: 92vw;
  max-width: 1280px;
  margin: 5vh auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.stage-modal__header,
.stage-modal__footer {
  padding: 0.6rem 0.8rem;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}
.stage-modal__footer {
  border-top: 1px solid #eee;
  border-bottom: 0;
}
.stage-modal__body {
  padding: 0.8rem;
  max-height: 76vh;
  overflow: auto;
  position: relative;
}

/* ===== Misc polish ===== */
.stree-title.stree-drop-target a {
  text-decoration: none;
}
.stree-title.stree-drop-target.droppable-hover a {
  text-decoration: underline;
}

/***** Tabs *****/
.jstTabs.tabs {
  height: 2.6em;
  margin-bottom: 1.2em;
  position: relative;
  overflow: hidden;
}
.jstTabs.tabs ul {
  margin: 0;
  position: absolute;
  bottom: 0;
  padding-left: 0.5em;
  width: 2000px;
  border-bottom: 1px solid #bbbbbb;
}
.jstTabs.tabs ul li {
  float: left;
  list-style-type: none;
  white-space: nowrap;
  margin-right: 4px;
  position: relative;
  margin-bottom: -1px;
}
.jstTabs.tabs ul li a {
  display: block;
  font-size: 0.9em;
  text-decoration: none;
  /*line-height:1.3em;*/
  padding: 4px 6px 4px 6px;
  border: 1px solid #ccc;
  border-bottom: 1px solid #bbbbbb;
  color: #999;
  font-weight: bold;
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
}

.jstTabs.tabs ul li a:hover {
  color: #777;
  text-decoration: none;
}

.jstTabs.tabs ul li a.selected {
  background-color: #fff;
  border: 1px solid #bbbbbb;
  border-bottom: 1px solid #fff;
  color: #444;
}

.jstTabs.tabs ul li a.selected:hover {
  background-color: #fff;
}

.jstTabs.tabs {
  margin-bottom: -1px;
}

.jstTabs.tabs ul {
  border-bottom: 0;
}

.jstTabs.tabs li:before {
  display: inline-block;
  vertical-align: middle;
  height: 100%;
}
.jstTabs.tabs li a {
  display: inline-block;
  vertical-align: bottom;
  line-height: 19px;
  border-bottom: 1px solid transparent;
}

.wiki-preview {
  background-color: #ffffff;
  border: 1px solid #bbbbbb;
}

#match-stage-root {
  height: calc(100vh - 140px); /* 페이지 헤더 높이에 맞게 숫자 조정 */
  overflow: auto;
  position: relative;
}

#match-stage-root .pane-right {
  position: sticky;
  top: 8px; /* 고정될 상단 여백 */
  align-self: flex-start; /* flex 늘어짐 방지 */
}

#match-stage-root .stage-orphans {
  max-height: calc(100vh - 140px - 16px); /* 컨테이너 높이에서 여백을 뺀 값 */
  overflow: auto;
  background: #fff;
}

#match-stage-root .stage-orphans__header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fafafa;
}

/* 오른쪽 목록에서 다중 선택 표시 */
.orphan-item.is-selected {
  border-color: #6b8aff;
  background: #eef3ff;
}
.stage-orphans__tools {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #eee;
  background: #fff;
}
.stage-orphans__tools .orphan-search {
  flex: 1 1 auto;
  min-width: 120px;
  padding: 0.35rem 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}
.stage-orphans__tools .orphan-type {
  flex: 0 0 170px;
  padding: 0.35rem 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}
.stage-orphans__tools .orphan-sort {
  flex: 0 0 170px;
  padding: 0.35rem 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}
.orphan-empty {
  text-align: center;
}
td {
  white-space: normal;
  word-wrap: break-word;
  word-break: break-all;
}

div.tabs:not(#main-menu) {
  height: 32px;
  margin-bottom: -0.9px;
}

#preview_issue_description p {
  padding-left: 0px;
}
