/* ---------------------------------------------------------------------------
 * IK000110_P01.xfdl 변환본 — IK 리베이트 상세 (판매장려금 세부 내역) 모달.
 * Modal #A 22번째 인스턴스 + *표시 카테고리* 3번째 (Rule of Three 도달).
 *
 * 표시 카테고리 누적 3 사례:
 *   - IK000070_P01 (TR조직 변경 에러): 외부 rows + 엑셀
 *   - IK000071_P02 (매뉴얼 삭제 히스토리): 자체 검색 + 그리드
 *   - *본 commit (IK000110_P01)*: 컨텍스트(년/월/구분/거래처) 자동 조회 + 3 그리드 분할
 *   → 추출 보류: 3 사례 모두 *그리드 모양/입력 컨트롤/하단 버튼* 가 다름 (외부데이터/자체검색/자동조회).
 *
 * 디자인 컨셉:
 *   - 헤더: 표시 정형색 (#2c4368)
 *   - 본문: 컨텍스트 요약 1줄 + 3 섹션 (매출 / 차감 / 특별) 세로 배치
 *   - 푸터: 확인 단일 (close-only)
 *   - 사이즈: 480x540 — 원본 xfdl 447x479 와 근접 (DHTMLX 의 800x680 window frame 은 무시)
 * --------------------------------------------------------------------------- */

#ik-rebate-detail-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.45);
  align-items: center;
  justify-content: center;
  font-family: 'Pretendard', 'Malgun Gothic', sans-serif;
}
#ik-rebate-detail-modal.is-open { display: flex; }

#ik-rebate-detail-modal .layer-wrap {
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#ik-rebate-detail-modal .layer-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 2px solid #2c4368;
  background: #2c4368;
  color: #ffffff;
}
#ik-rebate-detail-modal .layer-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}
#ik-rebate-detail-modal .layer-close {
  background: transparent;
  border: 0;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

#ik-rebate-detail-modal .layer-content {
  padding: 12px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

/* 컨텍스트 요약 (어떤 셀의 상세인지) */
#ik-rebate-detail-modal .context-bar {
  background: #f7fafe;
  border: 1px solid #d8e3f0;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12px;
  color: #2c4368;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
#ik-rebate-detail-modal .context-bar > span > strong {
  font-weight: 600;
  margin-left: 4px;
}

/* 3 섹션 공통 — 각 그리드 묶음 */
#ik-rebate-detail-modal .section {
  display: flex;
  flex-direction: column;
}
#ik-rebate-detail-modal .section-title {
  font-size: 13px;
  font-weight: 600;
  color: #2c4368;
  margin: 0 0 4px;
  padding-left: 6px;
  border-left: 3px solid #2c4368;
}
#ik-rebate-detail-modal .grid-shell {
  border: 1px solid #c8d3e0;
  border-radius: 3px;
  overflow: hidden;
}
#ik-rebate-detail-modal .grid-shell table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
#ik-rebate-detail-modal .grid-shell th,
#ik-rebate-detail-modal .grid-shell td {
  padding: 6px 8px;
  border-bottom: 1px solid #e3e8ee;
  text-align: right;
}
#ik-rebate-detail-modal .grid-shell th {
  background: #f0f4f9;
  color: #344b6e;
  font-weight: 600;
  text-align: center;
  border-bottom: 1px solid #c8d3e0;
}
#ik-rebate-detail-modal .grid-shell th:first-child,
#ik-rebate-detail-modal .grid-shell td:first-child {
  text-align: left;
}
#ik-rebate-detail-modal .grid-shell tr:last-child td { border-bottom: 0; }
#ik-rebate-detail-modal .grid-shell .empty-row td {
  text-align: center;
  color: #888;
  padding: 16px 8px;
}
#ik-rebate-detail-modal .grid-shell .total-row td {
  background: #fff8e6;
  font-weight: 600;
  color: #b65a00;
  border-top: 1px solid #f0d68a;
}

#ik-rebate-detail-modal .layer-footer {
  display: flex;
  justify-content: center;
  padding: 10px 16px;
  border-top: 1px solid #e1e5eb;
  background: #f7f8fa;
}
#ik-rebate-detail-modal .btn {
  min-width: 80px;
  padding: 6px 16px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #2c4368;
  background: #2c4368;
  color: #ffffff;
}
#ik-rebate-detail-modal .btn:hover { background: #1f314c; }
