/* ══════════ 웹 인증 셸 (WISE AppLayout 구조 이식) ══════════ */
.kx-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── 사이드바 ── */
.kx-shell__sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--color-white);
  border-right: var(--border-card);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: width 0.2s ease;
}
/* 데스크톱 접힘 — 사이드바 숨김(콘텐츠 전폭). */
.kx-shell.is-nav-collapsed .kx-shell__sidebar {
  width: 0;
  overflow: hidden;
  border-right: none;
}

/* 브랜드 — 실제 KINTEX CI 워드마크. 다크 모드 대비 화이트 플레이트(JPG 는 알파 없음). */
.kx-shell__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 56px;
  flex: none;
  padding: 0 var(--space-4);
  border-bottom: var(--border-card);
  text-decoration: none;
  overflow: hidden;
}
.kx-shell__brand-logo {
  height: 22px;
  width: auto;
  flex: none;
  background: #fff;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  display: block;
}
.kx-shell__brand-subs {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}
.kx-shell__brand-sub {
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  line-height: 1.15;
  color: var(--color-neutral-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kx-shell__brand-sub--en {
  font-size: 9px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.02em;
  color: var(--color-neutral-400, var(--color-neutral-500));
  text-transform: uppercase;
}

/* 행사 스위처 */
.kx-shell__event-switch {
  margin: var(--space-3) var(--space-3) 0;
  padding: var(--space-3);
  background: var(--color-neutral-050);
  border: var(--border-card);
  border-radius: var(--radius-lg);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: none;
}
.kx-shell__event-name {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kx-shell__event-meta {
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 메뉴 검색(WISE NavSearch 이식) — 브랜드/행사 아래 고정(스크롤 영역 위). ── */
.kx-shell__nav-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: none;
  padding: var(--space-3) var(--space-4) 0;
}
.kx-shell__nav-search-icon {
  position: absolute;
  left: calc(var(--space-4) + 11px);
  color: var(--color-neutral-500);
  pointer-events: none;
}
.kx-shell__nav-search-input {
  width: 100%;
  height: 34px;
  padding: 0 32px 0 34px;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-pill);
  background: var(--color-neutral-050);
  color: var(--color-neutral-900);
  font-size: var(--fs-body);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.kx-shell__nav-search-input::placeholder {
  color: var(--color-neutral-500);
}
.kx-shell__nav-search-input:focus {
  border-color: var(--color-primary-600);
  box-shadow: 0 0 0 2px var(--color-primary-100);
}
.kx-shell__nav-search-clear {
  position: absolute;
  right: calc(var(--space-4) + 6px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-neutral-500);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.kx-shell__nav-search-clear:hover {
  background: var(--color-neutral-100);
  color: var(--color-neutral-900);
}
/* 검색 결과 없음/빈 메뉴 */
.kx-shell__nav-empty {
  padding: var(--space-4);
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
  text-align: center;
}
/* 검색 결과 그룹 헤더(클릭 불가, 아코디언 토글 없이 그룹 라벨만). */
.kx-shell__group-title--static {
  cursor: default;
}
.kx-shell__group-title--static:hover {
  background: transparent;
  color: var(--color-neutral-700);
}
/* 검색어 매칭 하이라이트 */
.kx-shell__nav-hl {
  background: var(--color-warning-100, var(--color-primary-100));
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* 메뉴 스크롤 영역 — 사이드바 중앙(하단 사용자 고정). */
.kx-shell__nav-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-3) 0 var(--space-4);
}
.kx-shell__nav {
  list-style: none;
  margin: 0;
  padding: 0 var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kx-shell__nav--sub {
  padding: 2px 0 var(--space-2);
}
/* 소그룹 구분 헤더(시스템관리 20항목 정리) — 클릭 불가, WISE 구분선 라벨. */
.kx-shell__nav-section {
  margin: var(--space-2) 0 2px;
  padding: 4px var(--space-4) 3px;
  font-size: var(--fs-nano);
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-neutral-500);
  border-top: 1px solid var(--color-neutral-100);
}
.kx-shell__nav-section:first-child {
  margin-top: 0;
  border-top: none;
}

/* 대분류 그룹(아코디언) */
.kx-shell__group {
  padding: 0 var(--space-3);
}
.kx-shell__group-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 9px var(--space-4);
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--color-neutral-700);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.kx-shell__group-title:hover {
  background: var(--color-neutral-050);
  color: var(--color-neutral-900);
}
.kx-shell__group-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kx-shell__group-caret {
  flex: none;
  color: var(--color-neutral-500);
  transition: transform 0.2s ease;
}
.kx-shell__group-caret.is-open {
  transform: rotate(180deg);
}

/* 링크 */
.kx-shell__nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 8px var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--color-neutral-700);
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.kx-shell__nav-link:hover {
  background: var(--color-neutral-050);
  color: var(--color-neutral-900);
}
.kx-shell__nav-link.is-active {
  background: var(--color-primary-100);
  color: var(--color-primary-700);
  font-weight: var(--fw-semibold);
}
.kx-shell__nav-link--top {
  font-weight: var(--fw-semibold);
}
/* 스코프 진입(button) — nav-link 와 동일 표현. */
.kx-shell__nav-link--btn {
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.kx-shell__nav-icon {
  width: 18px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-neutral-500);
}
.kx-shell__nav-link.is-active .kx-shell__nav-icon {
  color: var(--color-primary-700);
}
/* 하위 링크 앞 점 마커(들여쓰기 정렬) */
.kx-shell__nav-dot {
  width: 5px;
  height: 5px;
  margin-left: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  flex: none;
}
.kx-shell__nav-link.is-active .kx-shell__nav-dot {
  opacity: 1;
  background: var(--color-primary-600);
}

/* ── 하단 사용자 영역 (반응형 재정렬) ── */
.kx-shell__user {
  flex: none;
  border-top: var(--border-card);
  padding: var(--space-3) var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.kx-shell__user-profile {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 6px var(--space-2);
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
}
.kx-shell__user-profile:hover {
  background: var(--color-neutral-050);
}
.kx-shell__avatar {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--color-primary-100);
  color: var(--color-primary-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-semibold);
  font-size: 13px;
}
.kx-shell__user-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kx-shell__user-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.kx-shell__user-action {
  width: 34px;
  height: 34px;
  flex: none;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-neutral-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.kx-shell__user-action:hover {
  background: var(--color-neutral-050);
  color: var(--color-primary-600);
}
/* 언어 셀렉트 — 액션 행에서 가운데 신축(줄바꿈/오버플로 방지). */
.kx-shell__user-lang {
  flex: 1 1 auto;
  justify-content: center;
  overflow: hidden;
}

/* ── 모바일 드로어 백드롭(데스크톱 미표시) ── */
.kx-shell__backdrop {
  display: none;
}

/* ══════════ 메인 컬럼 ══════════ */
.kx-shell__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.kx-shell__topbar {
  height: 56px;
  flex-shrink: 0;
  background: var(--color-white);
  border-bottom: var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--gutter);
}
.kx-shell__topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1 1 auto;
  min-width: 0;
}
.kx-shell__nav-toggle {
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-neutral-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.kx-shell__nav-toggle:hover {
  background: var(--color-neutral-100);
  color: var(--color-neutral-900);
}
.kx-shell__crumb {
  font-size: var(--fs-body);
  color: var(--color-neutral-500);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.kx-shell__crumb-root {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.kx-shell__crumb-sep {
  color: var(--color-neutral-200);
  flex: none;
}
.kx-shell__crumb-cur {
  color: var(--color-neutral-900);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kx-shell__topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: none;
}
.kx-shell__icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--color-neutral-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kx-shell__icon-btn:hover {
  background: var(--color-neutral-100);
}

.kx-shell__content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
}

/* ── 하단 상태바/푸터 (design.md §2-2, 약 36px) ── */
.kx-shell__footer {
  flex-shrink: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  background: var(--color-neutral-050);
  border-top: var(--border-card);
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
}
.kx-shell__footer-copy {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kx-shell__footer-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.kx-shell__footer-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.kx-shell__footer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-neutral-500);
}
.kx-shell__footer-status.is-ok .kx-shell__footer-dot {
  background: var(--color-success);
}
.kx-shell__footer-status.is-down {
  color: var(--color-error);
}
.kx-shell__footer-status.is-down .kx-shell__footer-dot {
  background: var(--color-error);
}
.kx-shell__footer-sep {
  color: var(--color-neutral-200);
}
.kx-shell__footer-link {
  color: var(--color-neutral-500);
  text-decoration: none;
}
.kx-shell__footer-link:hover {
  color: var(--color-primary-600);
  text-decoration: underline;
}

/* ── MDI 문서 탭 스트립 (design.md §2.7-2) ── */
.kx-mdi {
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 40px;
  padding: 0 var(--space-3);
  background: var(--color-neutral-050);
  border-bottom: var(--border-card);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.kx-mdi__tab {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 200px;
  padding: 0 var(--space-2) 0 var(--space-3);
  border: 1px solid transparent;
  border-bottom: none;
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
  align-self: flex-end;
  height: 34px;
}
.kx-mdi__tab:hover {
  background: var(--color-neutral-100);
}
.kx-mdi__tab.is-active {
  background: var(--color-white);
  border-color: var(--color-neutral-200);
  box-shadow: inset 0 2px 0 var(--color-primary-600);
}
.kx-mdi__tab-btn {
  min-width: 0;
  flex: 1;
  display: inline-flex;
  align-items: center;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  color: var(--color-neutral-500);
}
.kx-mdi__tab.is-active .kx-mdi__tab-btn {
  color: var(--color-neutral-900);
  font-weight: var(--fw-semibold);
}
.kx-mdi__tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kx-mdi__tab-close {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-neutral-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.kx-mdi__tab-close:hover {
  background: var(--color-neutral-200);
  color: var(--color-neutral-900);
}

/* ══════════ 반응형 ══════════ */
/* <1024px — 사이드바를 오버레이 드로어로. 접힘 시 화면 밖으로 슬라이드. */
@media (max-width: 1024px) {
  .kx-shell__sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    z-index: 40;
    box-shadow: var(--shadow-level2);
    transform: translateX(0);
    transition: transform 0.2s ease;
  }
  .kx-shell.is-nav-collapsed .kx-shell__sidebar {
    width: var(--sidebar-w);
    overflow: hidden;
    border-right: var(--border-card);
    transform: translateX(-100%);
  }
  .kx-shell__backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 14, 24, 0.5);
    z-index: 35;
  }
}

/* 모바일 폭에서는 탭 스트립 숨김(단일 화면 포커스 — §2.7-6). */
@media (max-width: 720px) {
  .kx-mdi {
    display: none;
  }
}

@media (max-width: 640px) {
  .kx-shell__crumb-root,
  .kx-shell__crumb-sep {
    display: none;
  }
  .kx-shell__topbar {
    padding: 0 var(--space-4);
  }
}

/* MDI 모두 닫기 버튼 — 탭 스트립 우측, 2개 이상일 때만 노출 */
.kx-mdi__closeall {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  padding: 0 10px;
  height: 28px;
  align-self: center;
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
  background: transparent;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}
.kx-mdi__closeall:hover {
  color: var(--color-error);
  border-color: var(--color-error);
}
