.modal-container-wrap {
  position: relative;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  height: 100%;
  z-index: 0;
}


.modal-container-wrap .modal-container {
  margin: 0;
}


.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  padding: 20px !important;
  background: transparent;
  overflow: hidden;
  z-index: 3000;
  outline: 0;
}

.modal.is-root {
  background: rgba(255, 255, 255, 0.95);
}

.modal.is-second {
  background: rgba(255, 255, 255, 0.95);
}

.modal.is-deep {
  background: transparent;
}


/* 세로 중앙정렬 — modal-container-wrap(플렉스 센터)을 안 쓰는 모달이 화면 상단에 붙던 것 보정.
   직계 자식만 대상이라 wrap 을 쓰는 모달(sms-send·farmCheck 등)은 영향 없음.
   modal-container 는 max-height:100% 라 화면보다 커질 수 없어 위로 잘릴 일도 없음. */
.modal > .modal-container {
  top: 50%;
  transform: translateY(-50%);
}

.modal-container {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 100%;
  background: var(--colorF);
  z-index: 1010;
  border-radius: 10px;
  width: fit-content;
  margin: 0 auto;
}

.modal-container.border {
  border: solid 1px #ddd;
  border-radius: 5px;
}



.modal-container .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  /* QA 팝업통일: 품목 분류작업 modal 기준 — 파란 그라디언트 헤더 + 흰 글씨 (fragment-popup-header 와 동일) */
  background: linear-gradient(135deg, #2c7be5, #1e6fd9);
  color: #fff;
  border-radius: 5px 5px 0 0;
}
.modal-container .modal-header h2,
.modal-container .modal-header .modal-title {
  color: #fff;
}
.modal-container .modal-header h2 {
  font-size: 18px;
  line-height: 1.4;
  margin: 0;
}
/* QA 팝업통일: 헤더 X버튼을 분류팝업(fragment-popup-close) 기준으로 통일.
   비스코프 .modal-close 의 떠있는 원형(absolute·right:-15px·흰배경·어두운색)을 리셋 → 파란헤더 안 흰색 인라인 X. */
.modal-container .modal-header .modal-close {
  position: static;
  transform: none;
  top: auto;
  right: auto;
  width: auto;
  height: auto;
  min-width: auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
}
.modal-container .modal-header .modal-close i {
  color: #fff;
}
.modal-container .modal-header .modal-close:hover {
  opacity: 0.8;
  background: transparent;
}

.modal-container .modal-header.column {
  flex-direction: column;
  align-items: flex-start;
  position: relative;
}

/* 세로형 헤더에서는 X 가 제목·설명 아래로 흘러내리므로 우상단에 고정 */
.modal-container .modal-header.column .modal-close {
  position: absolute;
  top: 12px;
  right: 20px;
}

@media screen and (max-width: 767px) {
  .modal-container .modal-header {
    padding: 10px 12px;
  }
}

.modal-container .modal-header .modal-title {
  padding-right: 20px;
  font-size: 24px;
  line-height: 32px;
  letter-spacing: -0.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: keep-all;
  overflow: hidden;
}

@media screen and (max-width: 767px) {
  .modal-container .modal-header .modal-title {
    font-size: 20px;
    line-height: 28px;
  }
}

.modal-container .modal-header .btn-close {
  display: block;
  position: relative;
  width: 30px;
  height: 30px;
}

.modal-container .modal-header .btn-close::before,
.modal-container .modal-header .btn-close::after {
  content: ' ';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 24px;
  margin-top: -12px;
  margin-left: -1px;
  background: #fff;
}

.modal-container .modal-header .btn-close::before {
  transform: rotate(45deg);
}

.modal-container .modal-header .btn-close::after {
  transform: rotate(-45deg);
}

.modal-container .modal-body {
  max-height: 100%;
  overflow-y: auto;
  /* 예전엔 padding-top:0 이라 파란 헤더 바로 밑에 첫 줄이 붙어 답답했다
     (settingpopup·crop-modal 은 각자 보정 중이었음) → 베이스에서 상단 여백 확보 */
  padding: 20px;
  margin-bottom: 20px;
  min-width: 500px;
}

/* 첫 자식이 자체 margin-top 을 가진 모달(card-approval 등)에서 20+20 으로 벌어지지 않게 */
.modal-container .modal-body > *:first-child {
  margin-top: 0;
}

@media screen and (max-width: 767px) {
  .modal-container .modal-body {
    padding: 20px 12px;
  }
}

.modal-container .modal-footer {
  padding: 20px;
}

/* QA 팝업통일: 저장/등록(primary) 버튼을 헤더와 같은 파랑(#2c7be5)으로 통일 */
.modal-container .modal-footer .btn-primary {
  background: #2c7be5;
  border-color: #2c7be5;
}
.modal-container .modal-footer .btn-primary:hover {
  background: #1e6fd9;
  border-color: #1e6fd9;
}







.modal-wrapper {
  background: #fff;
  border: 1px solid var(--colorC);
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 100px;
  text-align: center;
  line-height: 30px;
  font-size: 20px;
  font-weight: 800;
  position: absolute;
  top: 0;
  right: -15px;
  transform: translateY(-50%);
  color: var(--theme2);
  background: var(--color0);
  transition: all .3s;
  border: solid 1px transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-header {
  position: relative;
}

.modal-header h2 {
  font-family: "JalnanGothic";
  font-size: 24px;
  line-height: 1.25;
  font-weight: normal;
  color: #333;
  white-space: nowrap;
}


.modal-header .sub-depth-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icons {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
}

.modal-icons a {
  background: #dfdfdf;
  font-size: 16px;
  padding: 7px;
  border-radius: 1px;
}

.modal-icons a i {
  font-size: 16px;
  color: var(--color7);
}

.modal-icons button {
  margin-left: 5px;
}

.modal-options-wrap {
  position: relative;
  display: flex;
  margin-bottom: 10px;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 5px;
  border: solid 1px var(--colorD);
  background: var(--light-gray);
}

.modal-options-wrap.between {
  justify-content: space-between;
}

.modal-options {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 500;
  font-size: 14px;
}

.modal-body {
  position: relative;
}


.modal-content {
  position: relative;
  display: flex;
  width: 100%;
  gap: 20px;
}

.modal-sub-title {
  font-weight: 500;
  margin-bottom: 10px;
}

.modal-flex {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.modal-flex.between {
  justify-content: space-between;
}

.modal-sub-title h3 {
  font-family: "JalnanGothic";
  font-size: 20px;
  color: #333;
  white-space: nowrap;
}

.modal-table {
  position: relative;
  flex: 2;
}

.modal-table table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.modal-table th {
  border: 1px solid var(--table-01-line);
  background: var(--th-02-background);
  font-size: 15px;
  font-weight: 600;
  min-width: 150px;
  /* text-align: left; */
}

/* .modal-table th.essen{
    background-color: #e2e9f7;
    color: #08a1bc;
} */


.modal-table td {
  padding: 5px 10px;
  border: 1px solid var(--table-01-line);
  font-size: 15px;
  font-weight: 600;
  /* text-align: left; */
}

.modal-table input[type="text"],
.modal-table input[type="number"],
.modal-table select {
  width: 100%;
  padding: 5px;
}

.modal-table input[readonly] {
  background: var(--light-gray);
}

.modal-aside {
  border: 1px solid #ccc;
  width: 250px;
  display: flex;
  flex-direction: column;
}

.memo-header {
  display: flex;
  gap: 6px;
  padding: 5px 10px;
  background: #f3f3f3;
  border-bottom: 1px solid #ccc;
  align-items: center;
  font-weight: bold;
}

.memo-header button {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 16px;
}

#memo-box {
  flex: 1;
  padding: 6px;
  font-size: 14px;
}



.modal-center-arrow {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px;
}

.modal-center-arrow::before {
  content: '';
  width: 28px;
  height: 28px;
  transform: rotate(45deg);
  border-right: 12px solid #517084;
  border-bottom: 12px solid #517084;
  border-radius: 3px;
  background-color: transparent;
  margin: 10px auto;
  transform: rotate(-45deg);
}

.memo-aside {
  position: relative;
  flex: 1;
  margin-bottom: 10px;
  max-width: 320px;
}

.memo-aside h4 {
  padding: 15px;
  border: solid 1px var(--colorC);
  border-radius: 5px 5px 0 0;
  background: var(--light-gray);
}

.memo-box {
  position: relative;
  padding: 15px;
  border-top: 1px solid var(--colorC);
  /* 모든 항목 위쪽 보더만 유지 */
  border-left: 1px solid var(--colorC);
  border-right: 1px solid var(--colorC);
  border-radius: 0;
  /* 아래 보더 제거 → 겹침 방지 */
  border-bottom: none;
  background: #fbfbfb;
}

/* 마지막 요소는 아래쪽 보더 추가 */
.memo-box:first-of-type {
  border-top: 0;
}


.memo-date {
  margin-bottom: 5px;
}

.memo-title {
  margin: 10px 0;
}

.memo-content {
  line-height: 1.2;
}

.memo-list-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

#memo-list {
  position: relative;
  overflow-y: auto;
  max-height: 470px;
}


#memo-list::-webkit-scrollbar {
  display: none;
}


.memo-box button {
  margin-right: 5px;
  border: solid 1px blue;
  color: #545454;
  background: none;
  border: solid 1px #e1e1e1;
  min-width: fit-content;
  margin-top: 10px;
}



.memo-new {
  border: 1px solid var(--colorC);
  padding: 15px;
  border-radius: 0 0px 5px 5px;
  background: #fbfbfb;
}

.memo-new input[type="text"],
.memo-new textarea {
  width: 100%;
  padding: 5px;
  margin: 10px 0;
  border: 1px solid var(--colorC);
  border-radius: 4px;
}

.memo-new textarea {
  height: 80px;
  resize: vertical;
  background: var(--colorF);
}

.memo-save-btn {
  text-align: right;
}

.memo-save-btn button {
  color: var(--colorF);
  background: var(--color9);
  border: none;
  border-radius: 5px;
  padding: 8px 16px;
  cursor: pointer;
  text-align: right;
}


.modal-footer {}


.edit-title,
.edit-content {
  border: solid 1px var(--theme) !important;

}

/* 메모 모달 사이즈 조절 및 중앙 정렬 */
#modalMemo {
  display: none;
  align-items: center;
  justify-content: center;
}

#modalMemo[aria-modal="true"] {
  display: flex;
}

#modalMemo .modal-container {
  max-width: 60vw;
  max-height: 75vh;
  width: 60vw;
  display: flex;
  flex-direction: column;
  margin: auto;
}

#modalMemo .modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* 메모 모달 내부 테이블 레이아웃 수정 */
#modalMemo .popup-content-body__table .table-scroll {
  display: block;
  width: 100%;
}

#modalMemo .popup-content-body__table .table-scroll thead,
#modalMemo .popup-content-body__table .table-scroll tbody {
  width: 100%;
}

#modalMemo .popup-content-body__table .table-scroll thead {
  display: table-header-group;
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #f8f8f8;
}

#modalMemo .popup-content-body__table .table-scroll tbody {
  display: block;
  max-height: calc(40vh);
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
}

#modalMemo .popup-content-body__table .table-scroll thead tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

#modalMemo .popup-content-body__table .table-scroll tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

#modalMemo .popup-content-body__table {
  width: 100%;
  overflow-x: hidden;
}

#modalMemo .popup-content-body__table .table-scroll th,
#modalMemo .popup-content-body__table .table-scroll td {
  display: table-cell;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow: hidden;
  padding: 8px;
  vertical-align: top;
  white-space: normal;
}

/* 메모내용 컬럼은 텍스트가 길어도 줄바꿈 허용 */
#modalMemo .popup-content-body__table .table-scroll td:nth-child(4),
#modalMemo .popup-content-body__table .table-scroll td:nth-child(7) {
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  overflow: visible;
}

/* 메모 모달 테이블에 테이블 유틸 기능 비활성화 */
#modalMemo .popup-content-body__table .table-scroll[data-no-table-utils="true"] {
  pointer-events: auto;
}

#modalMemo .popup-content-body__table .table-scroll[data-no-table-utils="true"] th,
#modalMemo .popup-content-body__table .table-scroll[data-no-table-utils="true"] td {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

/* 테이블 유틸 관련 핸들러 제거 */
#modalMemo .popup-content-body__table .table-scroll[data-no-table-utils="true"] .column-resize-handle,
#modalMemo .popup-content-body__table .table-scroll[data-no-table-utils="true"] .column-drag-handle {
  display: none !important;
  pointer-events: none !important;
}

/* 메모 모달 테이블 컬럼 너비 설정 - 일반메모 (5개 컬럼) */
#modalMemo .popup-content-body__table .table-scroll th:nth-child(1),
#modalMemo .popup-content-body__table .table-scroll td:nth-child(1) {
  width: 60px;
  min-width: 60px;
  max-width: 60px;
}

#modalMemo .popup-content-body__table .table-scroll th:nth-child(2),
#modalMemo .popup-content-body__table .table-scroll td:nth-child(2) {
  width: 120px;
  min-width: 120px;
  max-width: 120px;
}

#modalMemo .popup-content-body__table .table-scroll th:nth-child(3),
#modalMemo .popup-content-body__table .table-scroll td:nth-child(3) {
  width: 60px;
  min-width: 60px;
  max-width: 60px;
}

#modalMemo .popup-content-body__table .table-scroll th:nth-child(4),
#modalMemo .popup-content-body__table .table-scroll td:nth-child(4) {
  width: auto;
  min-width: 200px;
}

#modalMemo .popup-content-body__table .table-scroll th:nth-child(5),
#modalMemo .popup-content-body__table .table-scroll td:nth-child(5) {
  width: 150px;
  min-width: 150px;
  max-width: 150px;
}

/* 매출메모/매입메모 테이블 컬럼 너비 (더 많은 컬럼) */
#modalMemo .popup-content-body__table .table-scroll th:nth-child(6),
#modalMemo .popup-content-body__table .table-scroll td:nth-child(6) {
  width: 12%;
}

#modalMemo .popup-content-body__table .table-scroll th:nth-child(7),
#modalMemo .popup-content-body__table .table-scroll td:nth-child(7) {
  width: 12%;
}

#modalMemo .popup-content-body__table .table-scroll th:nth-child(8),
#modalMemo .popup-content-body__table .table-scroll td:nth-child(8) {
  width: 19%;
}

/* 메모기록 모달 스타일 */
#modalNote {
  display: none;
  align-items: center;
  justify-content: center;
}

#modalNote[aria-modal="true"] {
  display: flex;
}

#modalNote .modal-container {
  max-width: 35vw;
  max-height: 80vh;
  width: 35vw;
  display: flex;
  flex-direction: column;
  margin: auto;
}

#modalNote .modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* 서식 툴바 스타일 */
.memo-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background-color: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 10px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.toolbar-group label {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}

.toolbar-select {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 12px;
  background-color: #fff;
}

.toolbar-color {
  width: 40px;
  height: 30px;
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
}

.toolbar-btn {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background-color: #fff;
  cursor: pointer;
  font-size: 14px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.toolbar-btn:hover {
  background-color: #f0f0f0;
}

.toolbar-btn.active {
  background-color: #007bff;
  color: #fff;
  border-color: #007bff;
}

.toolbar-btn.align-btn {
  font-size: 16px;
}

/* 텍스트 입력 영역 */
#modalNote .textarea-wrap {
  position: relative;
}

#modalNote #memoContent {
  width: 100%;
  min-height: 300px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

#modalNote .count {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-size: 12px;
  color: #666;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 2px 6px;
  border-radius: 3px;
}

/* 고객 등록/수정 모달 컴팩트 스타일 - 작은 화면 대응 */
#customer-add .modal-container,
#customer-edit .modal-container {
  max-height: 85vh;
  overflow-y: auto;
}

/* ===== 고객등록/수정 팝업 - 통일 레이아웃 ===== */
#customer-add .modal-container,
#customer-edit .modal-container {
  max-height: 95vh;
}

#customer-add .modal-container .modal-body,
#customer-edit .modal-container .modal-body {
  overflow-y: visible;
  max-height: none;
  margin-bottom: 0;
  padding-bottom: 10px;
}

/* 헤더 패딩 축소 */
#customer-add .modal-header,
#customer-edit .modal-header {
  padding: 12px 20px;
}

/* 푸터 패딩 축소 */
#customer-add .modal-footer,
#customer-edit .modal-footer {
  padding: 10px 20px;
}

/* 테이블 행 높이 축소 (70%) */
#customer-add .modal-table th,
#customer-edit .modal-table th {
  padding: 2px 8px;
  font-size: 13px;
  min-width: 80px;
  height: 28px;
}

#customer-add .modal-table td,
#customer-edit .modal-table td {
  padding: 2px 6px;
  font-size: 13px;
  height: 28px;
}

/* 입력 필드 높이 축소 */
#customer-add .modal-table input[type="text"],
#customer-add .modal-table input[type="number"],
#customer-add .modal-table select,
#customer-edit .modal-table input[type="text"],
#customer-edit .modal-table input[type="number"],
#customer-edit .modal-table select {
  padding: 2px 5px;
  font-size: 13px;
  min-height: 26px;
  height: 26px;
}

#customer-add .modal-table tr,
#customer-edit .modal-table tr {
  height: auto;
}

#customer-add .modal-options-wrap,
#customer-edit .modal-options-wrap {
  padding: 4px 8px;
  margin-bottom: 6px;
}

#customer-add .modal-aside,
#customer-edit .modal-aside {
  width: 200px;
}

#customer-add .modal-aside textarea,
#customer-edit .modal-aside textarea {
  min-height: 150px;
}

#customer-add .d-flex.gap3,
#customer-edit .d-flex.gap3 {
  gap: 5px;
}

#customer-add .d-flex.gap4,
#customer-edit .d-flex.gap4 {
  gap: 8px;
}

#customer-add .form-check,
#customer-edit .form-check {
  font-size: 13px;
}

/* color picker 높이 축소 */
#customer-add .color-picker,
#customer-edit .color-picker {
  height: 26px;
  width: 40px;
  padding: 1px;
}

/* 버튼 높이 축소 */
#customer-add .modal-table .btn,
#customer-edit .modal-table .btn {
  min-height: 26px;
  line-height: 22px;
  padding: 0 12px;
  font-size: 12px;
}