/*
 * W12 부서 관리 조직도 — WISE(UIWS system/dept·org) 이식 전용 스타일.
 * 좌 부서 트리 + 우 상세/편집 2-pane. design.md §1 토큰만 사용(임의 hex 최소).
 * admin-modules.css의 테이블 규칙과 겹치지 않도록 .kx-dept-* 전용 네임스페이스.
 */

/* ── 헤더 액션 ── */
.kx-dept-headActions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ── 통합검색 ── */
.kx-dept-toolbar {
  margin-top: var(--space-4);
  max-width: 420px;
}
.kx-dept-search {
  position: relative;
  display: flex;
  align-items: center;
}
.kx-dept-search__icon {
  position: absolute;
  left: 12px;
  color: var(--color-neutral-500);
  pointer-events: none;
}
.kx-dept-search__input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  border: var(--border-card);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-neutral-900);
  font-size: var(--fs-body);
}
.kx-dept-search__input:focus {
  outline: 2px solid var(--color-primary-100);
  border-color: var(--color-primary-600);
}

/* ── 2-pane 본문 ── */
.kx-dept-body {
  margin-top: var(--space-4);
  display: flex;
  gap: var(--space-4);
  align-items: stretch;
  min-height: 0;
}
.kx-dept-pane {
  background: var(--color-white);
  border: var(--border-card);
  border-radius: var(--radius-lg);
  overflow: auto;
}
.kx-dept-tree-pane {
  flex: 0 0 320px;
  min-width: 280px;
  max-width: 360px;
  padding: var(--space-3);
}
.kx-dept-detail-pane {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--space-4);
}

/* ── 좌: 트리 ── */
.kx-dept-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kx-dept-tree__empty {
  padding: var(--space-5) var(--space-3);
  text-align: center;
  color: var(--color-neutral-500);
  font-size: var(--fs-caption);
}
.kx-dept-tree__row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding-right: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-neutral-900);
  transition: background 120ms ease;
}
.kx-dept-tree__row:hover {
  background: var(--color-neutral-050);
}
.kx-dept-tree__row.is-selected {
  background: var(--color-primary-050);
}
.kx-dept-tree__row.is-selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: var(--radius-pill);
  background: var(--color-primary-600);
}
.kx-dept-tree__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--color-neutral-500);
  cursor: pointer;
  padding: 0;
}
.kx-dept-tree__toggle--empty { cursor: default; }
.kx-dept-tree__icon {
  flex: 0 0 auto;
  color: var(--color-primary-600);
}
.kx-dept-tree__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
}
.kx-dept-tree__row.is-selected .kx-dept-tree__name {
  font-weight: var(--fw-bold);
  color: var(--color-primary-700);
}
.kx-dept-tree__sort {
  flex: 0 0 auto;
  color: var(--color-neutral-500);
  font-size: var(--fs-caption);
}
.kx-dept-tree__off {
  flex: 0 0 auto;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-neutral-100);
  color: var(--color-neutral-500);
  font-size: var(--fs-caption);
}
.kx-dept-mark {
  background: var(--color-primary-100);
  color: var(--color-primary-700);
  border-radius: 2px;
  padding: 0 1px;
}

/* ── 우: 상세/편집 ── */
.kx-dept-detail__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
  color: var(--color-neutral-500);
  text-align: center;
}
.kx-dept-detail__head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  background: var(--color-white);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-neutral-200);
  z-index: 1;
}
.kx-dept-detail__headMain { min-width: 0; }
.kx-dept-detail__title {
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  color: var(--color-neutral-900);
  margin: 0;
}
.kx-dept-detail__path {
  margin: 2px 0 0;
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
}
.kx-dept-detail__actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 0 0 auto;
}
.kx-dept-detail__list { margin: 0; }
.kx-dept-detail__item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--color-neutral-200);
}
.kx-dept-detail__item:first-child { border-top: none; }
.kx-dept-detail__item dt {
  flex: 0 0 110px;
  color: var(--color-neutral-500);
  font-size: var(--fs-caption);
  margin: 0;
}
.kx-dept-detail__item dd {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: var(--color-neutral-900);
  font-size: var(--fs-body);
}
.kx-dept-code {
  font-family: var(--font-mono, monospace);
  font-size: 0.9em;
  color: var(--color-neutral-700);
}

/* ── 반응형 ── */
@media (max-width: 1023px) {
  .kx-dept-tree-pane { flex-basis: 260px; min-width: 230px; }
}
@media (max-width: 640px) {
  .kx-dept-body { flex-direction: column; gap: var(--space-3); }
  .kx-dept-tree-pane {
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
    max-height: 320px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .kx-dept-tree__row { transition: none; }
}
