/* ===============================
   목록장부 (엑셀형 매물 목록)
   PC/모바일: 모두 풀스크린 오버레이
   =============================== */

.listing-page {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5000;
}

.listing-page.open {
  display: flex;
}

/* PC: 풀스크린 오버레이 + 배경 어둡게 */
@media (min-width: 901px) {
  .listing-page.open {
    align-items: stretch;
    justify-content: stretch;
  }

  .listing-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
  }

  .listing-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-height: none;
    height: 100%;
    background: #f8f9fb;
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: none;
  }

  .listing-table .col-addr {
    min-width: 160px;
    max-width: 220px;
  }
}

/* 모바일: 풀스크린 (mobile.css에서 .listing-page.open 처리) */
@media (max-width: 900px) {
  .listing-page.open {
    flex-direction: column;
    background: #f8f9fb;
  }

  .listing-backdrop {
    display: none;
  }

  .listing-panel {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
  }
}

/* -------- 헤더 -------- */
.listing-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  min-height: 52px;
}

.listing-header__back {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #333;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.listing-header__back:hover {
  background: #f0f0f0;
}

.listing-header__title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: #111;
}

.listing-header__count {
  font-size: 14px;
  font-weight: 600;
  color: #666;
}

.listing-header__edit {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1px solid #2563eb;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: #2563eb;
  cursor: pointer;
}

.listing-header__edit:hover {
  background: #eff6ff;
}

.listing-edit-mode .listing-header__edit {
  background: #2563eb;
  color: #fff;
}

.listing-edit-mode .listing-header__edit:hover {
  background: #1d4ed8;
}

/* 수정 모드가 아닐 때는 거래상태 클릭 시 세부내역서로 이동 (커서 기본) */
.listing-panel:not(.listing-edit-mode) .listing-table .col-status .listing-status-badge {
  cursor: default;
}

.listing-panel.listing-edit-mode .listing-table .col-status .listing-status-badge {
  cursor: pointer;
}

/* -------- 툴바 (검색·정렬) -------- */
.listing-toolbar {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
}

.listing-scope-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
}

/* 목록장부에서는 표시범위 버튼(내매물/공용매물/팀/직원)만 사용 */
#listingScopeTabs {
  display: none !important;
}

.listing-scope-tab {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #fff;
  color: #374151;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.listing-scope-tab.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.listing-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.listing-search {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

/* 목록 검색 자동완성 (건물이름·상호·주소) */
.listing-search-autocomplete {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 100;
}

.listing-search-autocomplete.open {
  display: block;
}

.listing-search-autocomplete__item {
  padding: 10px 14px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}

.listing-search-autocomplete__item:last-child {
  border-bottom: none;
}

.listing-search-autocomplete__item:hover,
.listing-search-autocomplete__item.selected {
  background: #f0f7ff;
}

.listing-search::placeholder {
  color: #999;
}

.listing-toolbar__filter {
  flex-shrink: 0;
  height: 40px;
  padding: 0 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  background: #fff;
  color: #333;
  cursor: pointer;
}

.listing-toolbar__filter:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

/* 정렬 셀렉트 옆: 서버 정렬·헤더 정렬 초기화 */
.listing-toolbar__sort-reset {
  flex-shrink: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px dashed #c4c4c4;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: #fafafa;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
}

.listing-toolbar__sort-reset:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #334155;
}

.listing-toolbar__favorite {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 18px;
  background: #fff;
  color: #f59e0b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.listing-toolbar__favorite:hover {
  background: #fff7ed;
  border-color: #fbbf24;
}

.listing-toolbar__favorite.active {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}

.listing-sort-wrap {
  flex-shrink: 0;
}

.listing-sort {
  height: 40px;
  padding: 0 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  cursor: pointer;
}

/* 모바일: 상단 헤더·툴바 컴팩트 + 툴바 가로 스크롤(버튼 잘림 방지), 메인 topbar/icon-btn과 비슷한 크기 */
@media (max-width: 900px) {
  .listing-header {
    padding: 6px 10px;
    min-height: 0;
    gap: 8px;
    align-items: center;
  }

  .listing-header__back {
    width: 30px;
    height: 30px;
    font-size: 18px;
    border-radius: 5px;
  }

  .listing-header__title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
  }

  .listing-header__count {
    font-size: 11px;
    font-weight: 600;
  }

  .listing-header__edit {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 5px;
    border-width: 0.5px;
  }

  /* 한 줄로 유지하되 넘치면 가로 스크롤 + 얇은 스크롤바 */
  .listing-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding: 8px 10px;
    scrollbar-width: thin;
    scrollbar-color: #bdbdbd #f3f4f6;
  }

  .listing-toolbar::-webkit-scrollbar {
    height: 5px;
  }

  .listing-toolbar::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
  }

  .listing-toolbar::-webkit-scrollbar-thumb {
    background: #bdbdbd;
    border-radius: 3px;
  }

  .listing-toolbar > * {
    flex-shrink: 0;
  }

  .listing-toolbar .listing-search-wrap {
    flex: 0 0 auto;
    width: min(190px, 38vw);
    min-width: 116px;
  }

  .listing-search {
    height: 30px;
    padding: 0 10px;
    font-size: 13px;
    border-radius: 5px;
    border-width: 0.5px;
  }

  .listing-toolbar__filter,
  .listing-toolbar__columns,
  .listing-toolbar__print {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 5px;
    border: 0.5px solid #ddd;
    background: #fff;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
  }

  .listing-toolbar__sort-reset {
    height: 30px;
    padding: 0 8px;
    font-size: 11px;
    border-radius: 5px;
    border-width: 0.5px;
  }

  .listing-toolbar__print {
    border-color: #64748b;
    color: #334155;
  }

  .listing-toolbar__favorite {
    width: 30px;
    height: 30px;
    font-size: 16px;
    border-radius: 5px;
    border-width: 0.5px;
  }

  /* share.css보다 뒤에 로드되므로 #listingPage로 특이성 확보 */
  #listingPage .listing-toolbar__share {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 5px;
    border: 0.5px solid #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .listing-sort-wrap {
    flex-shrink: 0;
  }

  .listing-sort {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 5px;
    border-width: 0.5px;
  }

  .listing-table-zoom-controls {
    padding: 3px 6px;
    gap: 4px;
  }

  .listing-table-zoom-btn {
    width: 22px;
    height: 22px;
    font-size: 12px;
    border-width: 0.5px;
  }

  .listing-table-zoom-btn--reset {
    min-height: 22px;
    height: 22px;
    padding: 0 5px;
    font-size: 8px;
    border-radius: 4px;
  }

  .listing-table-zoom-pct {
    font-size: 9px;
    min-width: 30px;
  }

  .listing-sheet-bar {
    max-width: calc(100% - 175px);
    padding: 0 4px 0 0;
  }

  .listing-sheet-tab {
    max-width: 100px;
    font-size: 11px;
    padding: 4px 8px;
  }

  .listing-sheet-add {
    min-height: 22px;
    padding: 0 6px;
    font-size: 10px;
  }

  .listing-pagination {
    padding: 8px 10px;
  }
}

/* td에는 display:flex 금지 — 표 행/가로선이 열마다 어긋남. flex는 내부 래퍼에만 적용 */
.listing-name-cell-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.listing-fav-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: #d1d5db;
}

.listing-fav-btn--on {
  color: #f59e0b;
}

.listing-fav-btn:focus-visible,
.listing-toolbar__favorite:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* -------- 세분화 필터 (대분류 · 거래유형) -------- */
.listing-filters {
  flex-shrink: 0;
  padding: 10px 16px 12px;
  background: #fafbfc;
  border-bottom: 1px solid #eee;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: baseline;
}

.listing-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.listing-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  flex-shrink: 0;
}

.listing-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.listing-filter-chip {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.listing-filter-chip:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.listing-filter-chip.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.listing-filter-chip.active:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

/* 목록장부 매물필터(거래상태 체크박스) */
.listing-filter-chips--dealStatus {
  display: flex;
  flex-direction: row;
  gap: 12px;
  padding: 4px 0 2px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.listing-filter-chips--dealStatus .status-filter-option {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #1f2937;
  cursor: pointer;
  white-space: nowrap;
}

.listing-filter-chips--dealStatus input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

/* 표시범위(team/staff) 선택 드롭다운 */
.listing-scope-dropdowns {
  margin-top: 8px;
}

.listing-scope-dropdown-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
}

.listing-scope-dropdown-label {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
}

.listing-scope-dropdown-select {
  height: 34px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  font-size: 13px;
  min-width: 160px;
}

/* -------- 테이블 -------- */
.listing-table-wrap {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* 화면 표만: 스크롤 + 확대층(데이터 렌더/열설정 로직과 무관) */
.listing-table-wrap--screen {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.listing-table-wrap--screen > .listing-table-zoom-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.listing-table-zoom-inner {
  display: block;
  transform-origin: 0 0;
}

.listing-table-zoom-controls {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  padding: 4px 8px;
  border-top: 1px solid #e8e8e8;
  background: linear-gradient(to bottom, #fafbfc, #f4f5f7);
}

.listing-table-zoom-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.listing-table-zoom-pct {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  min-width: 34px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* 확대·축소: 작은 원형 버튼(＋는 시트 추가와 구분) */
.listing-table-zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: #475569;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.listing-table-zoom-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}

.listing-table-zoom-btn--reset {
  width: auto;
  min-height: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.listing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.listing-table thead {
  background: #f0f2f5;
}

.listing-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
  border-right: 1px solid #eef2f7;
}

.listing-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
  border-right: 1px solid #eef2f7;
}

/* 마지막 열은 세로선 제거 (동적 컬럼이므로 last-child 기준) */
.listing-table tr > th:last-child,
.listing-table tr > td:last-child {
  border-right: none;
}

/* 목록장부(화면/인쇄) 셀 좌우 패딩을 설정값으로 제어 */
.listing-table--screen th,
.listing-table--screen td {
  padding: 10px var(--listing-cell-pad-x-screen, 12px) !important;
}

.listing-table--print th,
.listing-table--print td {
  padding: 10px var(--listing-cell-pad-x-print, 8px) !important;
}

.listing-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

.listing-table tbody tr:hover {
  background: #e8f0fe;
}

.listing-table tbody tr:active {
  background: #d2e3fc;
}

/* 컬럼 너비 */
.listing-table .col-id {
  width: 48px;
  color: #6b7280;
}

.listing-table .col-name {
  min-width: 100px;
}

.listing-table .col-status {
  min-width: 90px;
  max-width: 110px;
}

.listing-table .listing-status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.listing-table .listing-status-badge--dealable {
  background: #dcfce7;
  color: #166534;
}

.listing-table .listing-status-badge--hold {
  background: #fef3c7;
  color: #92400e;
}

.listing-table .listing-status-badge--completed {
  background: #e5e7eb;
  color: #374151;
}

.listing-table .listing-status-badge--checking {
  background: #dbeafe;
  color: #1e40af;
}

.listing-table .col-status .listing-status-badge {
  cursor: pointer;
}

.listing-table .col-status .listing-status-badge:hover {
  filter: brightness(0.95);
}

/* 수정 모드: 개별 삭제 버튼 (작게) */
.listing-panel:not(.listing-edit-mode) .listing-col-delete {
  display: none;
}

.listing-table .col-delete {
  width: 32px;
  padding: 2px 4px;
  vertical-align: middle;
  text-align: center;
}

.listing-row-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #fff;
  color: #6b7280;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.listing-row-delete:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.listing-row-delete:active {
  background: #fee2e2;
}

/* 거래상태 즉시 수정 드롭다운 */
.listing-status-dropdown {
  display: none;
  position: absolute;
  z-index: 100;
  min-width: 120px;
  padding: 6px 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.listing-status-dropdown.open {
  display: block;
}

/* 표 바로 아래 줄: 왼쪽 시트 탭 + 오른쪽 확대·축소(%, 1:1) */
.listing-sheet-bar {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 2px;
  min-width: 0;
  max-width: calc(100% - 132px);
  background: transparent;
}

.listing-sheet-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.listing-sheet-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 140px;
  padding: 5px 10px;
  border: 1px solid #c5c5c5;
  border-bottom: 2px solid transparent;
  border-radius: 4px 4px 0 0;
  background: #e9e9e9;
  color: #333;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-tap-highlight-color: transparent;
}

.listing-sheet-tab:hover {
  background: #dedede;
}

.listing-sheet-tab.active {
  background: #fff;
  border-color: #9ca3af;
  border-bottom-color: #2563eb;
  color: #111;
  z-index: 1;
}

.listing-sheet-tab__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 2px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  color: #6b7280;
  font-weight: 700;
}

.listing-sheet-tab__close:hover {
  background: #fee2e2;
  color: #b91c1c;
}

/* 시트 추가: 알약형 + 라벨(확대 원형 ＋와 구분) */
.listing-sheet-add {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.listing-sheet-add__text {
  pointer-events: none;
  white-space: nowrap;
}

.listing-sheet-add:hover {
  border-color: #60a5fa;
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e3a8a;
}

.listing-sheet-add:active {
  transform: scale(0.98);
}

/* 목록 페이지네이션 */
.listing-pagination {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #fff;
  border-top: 1px solid #eee;
}

.listing-pagination.hidden {
  display: none;
}

.listing-pagination__info {
  font-size: 13px;
  color: #666;
  font-weight: 500;
}

.listing-pagination__btns {
  display: flex;
  gap: 8px;
}

.listing-pagination__btn {
  padding: 6px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: #374151;
  cursor: pointer;
}

.listing-pagination__btn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.listing-pagination__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.listing-status-dropdown__item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  text-align: left;
  cursor: pointer;
}

.listing-status-dropdown__item:hover {
  background: #f3f4f6;
}

.listing-table .col-addr {
  min-width: 140px;
  max-width: 200px;
}

.listing-table .col-cat {
  min-width: 110px;
}

.listing-table .col-price-sale,
.listing-table .col-price-deposit,
.listing-table .col-price-monthly,
.listing-table .col-price-key {
  min-width: 72px;
  white-space: nowrap;
}

.listing-table .col-area {
  width: 56px;
}

.listing-table .col-shortmemo {
  min-width: 120px;
  max-width: 200px;
}

.listing-table .shortmemo-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #6b7280;
  font-size: 12px;
}

/* 셀 텍스트 */
.listing-table .addr-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.listing-table .price-cell {
  font-weight: 700;
  color: #111;
}

.listing-table .badge-cell {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f3f4f6;
  color: #374151;
  font-size: 11px;
  font-weight: 700;
}

/* 분류: 상위 + 하위 작은 배너 */
.cat-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cat-badge {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.cat-badge--top {
  background: #e0e7ff;
  color: #3730a3;
}

.cat-badge--sub {
  background: #f3f4f6;
  color: #4b5563;
}

.cat-badge--deal {
  background: #d1fae5;
  color: #065f46;
}

/* -------- 빈 상태 -------- */
.listing-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #6b7280;
}

.listing-empty.hidden {
  display: none;
}

.listing-empty__icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.listing-empty p {
  margin: 0;
  font-size: 15px;
}

/* -------- 변경 로그 (asset_logs) -------- */
.log-toolbar {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  padding: 12px 16px;
  background: #fafbfc;
  border-bottom: 1px solid #eee;
}

.log-search-wrap {
  flex: 1;
  min-width: 140px;
}

.log-filters {
  display: flex;
  gap: 8px;
  align-items: center;
}

.log-action-filter {
  height: 40px;
  padding: 0 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  background: #fff;
  cursor: pointer;
}

.log-panel .log-loading,
.log-panel .log-content,
.log-panel .log-empty,
.log-panel .log-error {
  flex: 1;
  min-height: 0;
}

.log-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: #6b7280;
}

.log-loading p {
  margin: 0;
  font-size: 14px;
}

.log-loading__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: log-spin 0.8s linear infinite;
}

@keyframes log-spin {
  to { transform: rotate(360deg); }
}

.log-content {
  overflow: auto;
}

.log-empty .log-empty__hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: #9ca3af;
}

.log-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: #6b7280;
}

.log-error p {
  margin: 0;
  font-size: 14px;
}

.log-error__retry {
  padding: 10px 20px;
  border: 1px solid #3b82f6;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  background: #eff6ff;
  color: #2563eb;
  cursor: pointer;
}

.log-error__retry:hover {
  background: #dbeafe;
}

.log-table .col-date {
  width: 120px;
  white-space: nowrap;
  color: #6b7280;
  font-size: 13px;
}

.log-table .col-action {
  width: 80px;
}

.log-action-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.log-action--create {
  background: #d1fae5;
  color: #047857;
}

.log-action--update {
  background: #dbeafe;
  color: #1d4ed8;
}

.log-action--delete {
  background: #fee2e2;
  color: #b91c1c;
}

.log-action--status_change {
  background: #fef3c7;
  color: #b45309;
}

.log-table .col-addr {
  min-width: 140px;
  max-width: 220px;
  color: #374151;
}

.log-table .col-note {
  min-width: 120px;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #4b5563;
}

.log-table tbody tr[role="button"] {
  cursor: pointer;
}

.log-table tbody tr[role="button"]:hover {
  background: #f0f7ff;
}

/* =============================================================================
   목록장부 — 동적 열(너비·순서) / 열 설정 모달 / 인쇄(A4 가로)
   ============================================================================= */

@media (min-width: 901px) {
  .listing-toolbar__columns,
  .listing-toolbar__print {
    flex-shrink: 0;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    background: #fff;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
  }

  .listing-toolbar__columns:hover,
  .listing-toolbar__print:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
  }

  .listing-toolbar__print {
    border-color: #64748b;
    color: #334155;
  }
}

/* 화면 테이블: colgroup 너비 반영 */
.listing-table--screen {
  table-layout: fixed;
  /* 1번 스크린샷 기준 형태 유지용 최소 폭 (그 이하에서는 가로 스크롤) */
  min-width: 1200px;
  /* colgroup px 합이 더 크면 그만큼 넓어지고, 작으면 1200px 유지 */
  width: max-content;
}

.listing-th--resizable {
  position: relative;
  vertical-align: bottom;
}

.listing-th--resizable.listing-th--has-sort {
  vertical-align: middle;
}

/* 헤더: 제목 + (일부 열만) 세로 2칸 정렬 버튼 — 행 높이 유지 */
.listing-th-label-row {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding-right: 8px;
  max-width: 100%;
  box-sizing: border-box;
}

.listing-th-label-row .listing-th-label {
  padding-right: 0;
}

.listing-table th.listing-cell--num .listing-th-label-row {
  justify-content: flex-end;
  width: 100%;
}

/* 순번 열: 헤더 글자(「순번」)까지 열 너비 기준 가운데 — th 기본 left·라벨행 padding 보정 */
.listing-table th.listing-cell--center {
  text-align: center;
}

.listing-table th.listing-cell--center .listing-th-label-row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 100%;
  padding-left: 8px;
  padding-right: 8px;
  box-sizing: border-box;
}

.listing-table th.listing-cell--center .listing-th-label {
  text-align: center;
}

.listing-th-sort {
  display: inline-flex;
  flex-direction: column;
  flex-shrink: 0;
  justify-content: center;
  gap: 0;
  line-height: 0;
  margin-left: 1px;
}

.listing-th-sort-btn {
  display: block;
  width: 11px;
  height: 7px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  font-size: 7px;
  line-height: 7px;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 1px;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.listing-th-sort-btn:hover {
  background: #e2e8f0;
  color: #475569;
}

.listing-th-sort-btn--active {
  color: #2563eb;
  background: #dbeafe;
}

.listing-th-label {
  display: inline-block;
  min-width: 0;
}

/* 세로 구분 막대를 드래그해 열 너비 조절 (헤더 높이보다 짧게 + 살짝 입체) */
.listing-col-resize-handle {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  box-sizing: border-box;
  /* 헤더 높이보다 짧게 보이도록 세로 길이 제한 */
  height: 55%;
  min-height: 20px;
  max-height: 30px;
  width: 2px;
  cursor: col-resize;
  z-index: 2;
  border-radius: 1px;
  border: none;
  /* 기본 상태: 살짝만 보이는 은은한 연회색 라인 */
  background: #dde1e6;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  pointer-events: auto;
  /* 모바일: 롱프레스 드래그 시 스크롤/제스처와 충돌 완화 */
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

/* 보이는 선은 2px지만, 좌우로 투명 히트 영역을 두어 잡기 쉽게 함 */
.listing-col-resize-handle::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -6px;
  right: -6px;
}

/* 헤더 셀 hover 시 리사이즈 막대만 살짝 진하게 */
.listing-th--resizable:hover .listing-col-resize-handle {
  /* hover 시만 한 톤 진한 회색으로 약하게 강조 */
  background: #c4c9d1;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}

body.listing-col-resizing,
body.listing-col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

/* 숫자(금액·면적·#) 우측 정렬 — colClassName listing-cell--num */
.listing-table .listing-cell--num {
  text-align: right;
}

.listing-table .listing-cell--center {
  text-align: center;
}

.listing-table .listing-cell--left {
  text-align: left;
}

/* 주소·건물명·메모 열: 내용 말줄임 (너비는 settings_json 기준) */
.listing-table .listing-col--address .addr-cell,
.listing-table .listing-col--short_memo .shortmemo-cell,
.listing-table .listing-col--memo {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* 건물이름·상호 텍스트 말줄임 (인쇄·화면 공통) */
.listing-table .listing-col--name .name-cell {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 화면: 즐겨찾기+텍스트 flex 행 안에서 텍스트 영역만 줄어들게 */
.listing-table .listing-name-cell-inner .name-cell {
  flex: 1;
  min-width: 0;
}

/* 인쇄용 블록: 평소에는 숨김 */
.listing-print-mount {
  display: none;
  padding: 12px 16px;
}

.listing-print-mount__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 10px;
  flex-wrap: nowrap;
}

.listing-print-mount__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: #111;
  flex: 1;
  min-width: 0;
}

.listing-print-mount__brand {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  text-align: right;
  line-height: 1.35;
  flex-shrink: 0;
  max-width: 55%;
}

.listing-table--print {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
  font-size: 11px;
  border-collapse: collapse;
  box-sizing: border-box;
}

body.listing-printing .listing-table--print th,
body.listing-printing .listing-table--print td {
  box-sizing: border-box;
  overflow: hidden;
  word-break: break-word;
  vertical-align: top;
}

/* 인쇄 직전: 화면 UI 숨기고 인쇄 테이블만 표시 */
body.listing-printing .listing-no-print {
  display: none !important;
}

body.listing-printing .listing-print-mount {
  display: block !important;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

body.listing-printing #listingPage {
  position: static !important;
  overflow: visible !important;
  height: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  background: #fff !important;
}

body.listing-printing #listingPage .listing-panel {
  overflow: visible !important;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }

  body.listing-printing .listing-no-print,
  .listing-column-modal {
    display: none !important;
  }
  /*
   * 목록장부 인쇄: #listingPage·#listingPrintMount는 #layout > .map-wrap 안에 있다.
   * 예전에 #layout 또는 .map-wrap 전체를 숨기면 표까지 사라져 미리보기가 흰 화면이 됨.
   * → 사이드바·map-wrap의 형제 요소만 숨긴다.
   */
  body.listing-printing header.topbar,
  body.listing-printing #layout > aside,
  body.listing-printing .map-wrap > *:not(#listingPage),
  body.listing-printing .customer-crm-toast {
    display: none !important;
  }

  body.listing-printing .listing-print-mount {
    display: block !important;
    padding: 0;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  body.listing-printing .listing-print-mount__title {
    font-size: 12pt;
  }

  body.listing-printing .listing-print-mount__brand {
    font-size: 8pt;
    color: #111;
  }

  .listing-table--print {
    font-size: 9pt;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  .listing-table--print col {
    /* JS에서 퍼센트 지정; 혹시 남은 인라인 px 대비 */
    max-width: 100%;
  }

  .listing-table--print th,
  .listing-table--print td {
    min-width: 0 !important;
    overflow: hidden;
    word-break: break-word;
    box-sizing: border-box;
  }

  .listing-table--print tbody tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .listing-table--print thead {
    display: table-header-group;
  }
}

/* 인쇄 스케일 래퍼(JS에서 zoom 또는 transform 적용) */
.listing-print-scale-wrap {
  box-sizing: border-box;
  width: 100%;
}

/* 목록장부 인쇄 설정(브라우저 인쇄창 열기 전) */
.listing-print-settings-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 6100;
  align-items: center;
  justify-content: center;
}

.listing-print-settings-modal.open {
  display: flex;
}

.listing-print-settings-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.listing-print-settings-modal__panel {
  position: relative;
  z-index: 1;
  width: min(680px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.listing-print-settings-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.listing-print-settings-modal__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #111827;
}

.listing-print-settings-modal__close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.listing-print-settings-modal__close:hover {
  background: #f3f4f6;
  color: #374151;
}

.listing-print-settings-modal__body {
  padding: 12px 16px 14px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.listing-print-settings-modal__hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.45;
}

.listing-print-settings-modal__field {
  margin-bottom: 14px;
}

.listing-print-settings-modal__field--scale {
  margin-bottom: 14px;
}

.listing-print-settings-modal__scale-note {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #4b5563;
}

.listing-print-settings-modal__scale-note strong {
  color: #111827;
  font-weight: 800;
}

.listing-print-settings-modal__preview-wrap {
  margin-top: 4px;
}

.listing-print-settings-modal__preview-caption {
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 6px;
}

.listing-print-settings-modal__preview-caption-sub {
  font-weight: 600;
  color: #6b7280;
  margin-left: 4px;
}

/* A4 가로(297×210mm) 비율 — 모달 본문 가로폭에 맞춰 한 장 크기로 고정, 내부만 스크롤 */
.listing-print-settings-modal__preview-a4 {
  position: relative;
  width: 100%;
  aspect-ratio: 297 / 210;
  flex-shrink: 0;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: linear-gradient(145deg, #e8eaed 0%, #f3f4f6 100%);
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.listing-print-settings-modal .listing-print-preview-scale-wrap {
  position: absolute;
  inset: 4px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  padding: 6px 8px;
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.listing-print-settings-modal .listing-print-mount__header {
  margin: 0 0 8px;
}

.listing-print-settings-modal .listing-print-mount__title {
  font-size: 14px;
}

.listing-print-settings-modal .listing-print-mount__brand {
  font-size: 10px;
  max-width: 60%;
}

/* 인쇄 미리보기: 실제 인쇄 마운트와 동일 클래스, 모달 안에서만 셀 레이아웃 보강 */
.listing-print-settings-modal .listing-table--print {
  font-size: 10px;
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.listing-print-settings-modal .listing-table--print th,
.listing-print-settings-modal .listing-table--print td {
  min-width: 0;
  overflow: hidden;
  word-break: break-word;
  vertical-align: top;
  box-sizing: border-box;
}

.listing-print-settings-modal__label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 6px;
}

.listing-print-settings-modal__input {
  width: 5.5rem;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}

.listing-print-settings-modal__suffix {
  margin-left: 8px;
  font-size: 12px;
  color: #6b7280;
}

.listing-print-settings-modal__scale-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.listing-print-settings-modal__range {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.listing-print-settings-modal__scale-pct {
  font-size: 14px;
  font-weight: 700;
  color: #2563eb;
  min-width: 3.25rem;
  text-align: right;
}

.listing-print-settings-modal__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: #fafafa;
}

.listing-print-settings-modal__btn {
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: #374151;
  cursor: pointer;
}

.listing-print-settings-modal__btn:hover:not(:disabled) {
  background: #f3f4f6;
}

.listing-print-settings-modal__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.listing-print-settings-modal__btn--pri {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.listing-print-settings-modal__btn--pri:hover:not(:disabled) {
  background: #1d4ed8;
}

/* 열 설정 모달 */
.listing-column-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 6000;
  align-items: center;
  justify-content: center;
}

.listing-column-modal.open {
  display: flex;
}

.listing-column-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.listing-column-modal__panel {
  position: relative;
  z-index: 1;
  width: min(480px, 92vw);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.listing-column-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.listing-column-modal__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #111;
}

.listing-column-modal__close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
}

.listing-column-modal__close:hover {
  background: #f3f4f6;
}

.listing-column-modal__tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 12px;
}

.listing-column-modal__tab {
  padding: 10px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
}

.listing-column-modal__tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.listing-column-modal__body {
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.listing-column-modal__hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.45;
}

/* 셀 좌우 여백(열 간격 대체: padding 방식) */
.listing-column-pad {
  margin: 10px 0 12px;
}

.listing-column-pad__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.listing-column-pad__label {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
}

.listing-column-pad__value {
  font-size: 13px;
  font-weight: 800;
  color: #6b7280;
  white-space: nowrap;
}

.listing-column-pad__range {
  width: 100%;
  cursor: pointer;
}

.listing-column-order-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.listing-column-order-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
  cursor: grab;
}

.listing-column-order-item:active {
  cursor: grabbing;
}

.listing-column-order-item__drag {
  color: #9ca3af;
  font-size: 12px;
  user-select: none;
}

.listing-column-order-item__label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
}

.listing-column-req {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
}

.listing-column-modal__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: #fafafa;
}

.listing-column-modal__btn {
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: #374151;
  cursor: pointer;
}

.listing-column-modal__btn:hover {
  background: #f3f4f6;
}

.listing-column-modal__btn--primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.listing-column-modal__btn--primary:hover {
  background: #1d4ed8;
}
