/* ===== 인센티브 페이지 스타일 ===== */

/* 데이터 없음 메시지 */
.inc-nodata-msg {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-tertiary, #9CA3AF);
  font-size: 14px;
}
.inc-nodata-msg a { color: var(--blue, #3B82F6); text-decoration: underline; }

/* 업로드 결과 + 삭제 버튼 */
.inc-upload-ok {
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--green-bg, #ECFDF5);
  color: var(--green, #059669);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.inc-upload-err {
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--red-bg, #FEF2F2);
  color: var(--red, #DC2626);
  border-radius: 8px;
  font-size: 13px;
}
.inc-clear-btn {
  background: none;
  border: none;
  color: var(--text-tertiary, #9CA3AF);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.inc-clear-btn:hover {
  color: var(--red, #DC2626);
  background: rgba(220, 38, 38, 0.08);
}

/* V2 upload result - file-name-first layout */
.inc-upload-ok.inc-upload-ok-v2 {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 10px 14px;
}
.inc-upload-ok-main {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inc-upload-ok-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #1F2937);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inc-upload-ok-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.inc-upload-ok-sub {
  font-size: 12px;
  color: var(--text-secondary, #6B7280);
  font-weight: 400;
  padding-left: 24px;
}
.inc-upload-ok-time {
  font-size: 11px;
  color: var(--text-tertiary, #9CA3AF);
  font-weight: 400;
  padding-left: 24px;
}

/* ===== 업로드 UI 개선 ===== */

/* 상단 스텝 요약 바 */
.inc-upload-summary {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; margin-bottom: 16px;
  background: var(--card, #fff); border: 1px solid var(--border, #E5E7EB);
  border-radius: var(--radius, 10px); overflow-x: auto;
}
.inc-upload-step {
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.inc-step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-tertiary, #F3F4F6); color: var(--text-tertiary, #9CA3AF);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.inc-upload-step.done .inc-step-num { background: var(--green, #059669); color: #fff; }
.inc-step-label { font-size: 13px; font-weight: 500; color: var(--text-primary, #1F2937); }
.inc-step-badge {
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 100px;
}
.inc-step-badge.req { background: var(--blue-bg, #EFF6FF); color: var(--blue, #3B82F6); }
.inc-step-badge.opt { background: var(--bg-tertiary, #F3F4F6); color: var(--text-tertiary, #9CA3AF); }
.inc-step-status {
  font-size: 11px; color: var(--text-tertiary, #9CA3AF); margin-left: 2px;
}
.inc-upload-step.done .inc-step-status { color: var(--green, #059669); font-weight: 500; }
.inc-upload-step-arrow { color: var(--text-tertiary, #9CA3AF); display: flex; flex-shrink: 0; }

/* 업로드 카드 구분 */
.inc-upload-card.crm .upload-zone { border-color: var(--blue, #3B82F6); border-style: dashed; }
.inc-upload-card.crm .upload-zone:hover,
.inc-upload-card.crm .upload-zone.dragover { background: var(--blue-bg, #EFF6FF); }
.inc-upload-card.crm .upload-zone svg { stroke: var(--blue, #3B82F6); }

.inc-upload-card.cosmetics .upload-zone { border-color: var(--orange, #F59E0B); border-style: dashed; }
.inc-upload-card.cosmetics .upload-zone:hover,
.inc-upload-card.cosmetics .upload-zone.dragover { background: var(--yellow-bg, #FFFBEB); }
.inc-upload-card.cosmetics .upload-zone svg { stroke: var(--orange, #F59E0B); }

.inc-card-step {
  font-size: 10px; font-weight: 700; color: var(--text-tertiary, #9CA3AF);
  letter-spacing: 0.05em; margin-right: 4px;
}
.inc-card-badge {
  font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 100px;
  margin-left: 6px; vertical-align: middle;
}
.inc-card-badge.req { background: var(--blue-bg, #EFF6FF); color: var(--blue, #3B82F6); }
.inc-card-badge.opt { background: var(--bg-tertiary, #F3F4F6); color: var(--text-tertiary, #9CA3AF); }

/* 업로드 결과에 파일명+시간 표시 */
.inc-upload-file-info {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-tertiary, #9CA3AF);
  margin-top: 6px; flex-wrap: wrap;
}
.inc-file-name { color: var(--text-secondary, #6B7280); font-weight: 500; }
.inc-file-time { color: var(--text-tertiary, #9CA3AF); }
.inc-download-btn {
  background: none; border: none; cursor: pointer; padding: 2px 4px;
  color: var(--blue, #3B82F6); border-radius: 4px; display: inline-flex; align-items: center;
}
.inc-download-btn:hover { background: var(--blue-bg, #EFF6FF); }

/* 저장된 데이터 CRM/화장품 분리 */
.inc-saved-section {
  padding: 8px 10px; border-radius: 6px;
  background: var(--bg-secondary, #F9FAFB); margin-bottom: 6px;
}
.inc-saved-title {
  font-size: 11px; font-weight: 600; margin-bottom: 4px; text-transform: uppercase;
}
.inc-saved-title.crm { color: var(--blue, #3B82F6); }
.inc-saved-title.cosmetics { color: var(--orange, #F59E0B); }
.inc-saved-body { font-size: 12px; color: var(--text-secondary, #6B7280); display: flex; gap: 4px; flex-wrap: wrap; }

/* 파일 히스토리 */
.inc-history-empty { font-size: 13px; color: var(--text-tertiary, #9CA3AF); margin: 0; }
.inc-history-list { display: flex; flex-direction: column; gap: 6px; }
.inc-history-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 6px; background: var(--bg-secondary, #F9FAFB);
}
.inc-history-info { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.inc-history-type {
  font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px;
}
.inc-history-type.crm { background: var(--blue-bg, #EFF6FF); color: var(--blue, #3B82F6); }
.inc-history-type.cosmetics { background: #FEF3C7; color: var(--orange, #D97706); }
.inc-history-name { color: var(--text-primary, #111827); font-weight: 500; }
.inc-history-date { color: var(--text-tertiary, #9CA3AF); }
.btn-xs { font-size: 11px; padding: 3px 8px; }

/* ===== Activity log timeline ===== */
.inc-activity-log {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light, #E5E7EB);
}
.inc-activity-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #6B7280);
  margin-bottom: 8px;
}
.inc-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 3px 0;
  font-size: 12px;
}
.inc-activity-time {
  flex-shrink: 0;
  color: var(--text-tertiary, #9CA3AF);
  font-variant-numeric: tabular-nums;
  min-width: 80px;
}
.inc-activity-desc {
  color: var(--text-secondary, #6B7280);
}

/* ===== 직원별 화장품 상세 ===== */
.emp-cos-row:hover { background: var(--bg-secondary, #F9FAFB); }
.emp-cos-row.emp-cos-open { background: var(--blue-bg, #EFF6FF); }
.emp-cos-arrow {
  font-size: 9px; color: var(--text-tertiary, #9CA3AF);
  margin-left: 4px; display: inline-block; transition: transform 0.15s;
}
.emp-cos-detail-wrap {
  padding: 8px 16px 12px 28px;
  background: var(--bg-secondary, #F9FAFB);
  border-top: 1px solid var(--border, #E5E7EB);
}
.emp-cos-detail-table { font-size: 11px !important; }
.emp-cos-detail-table th { font-size: 10px !important; color: var(--text-tertiary, #9CA3AF); }
.emp-cos-detail-table td { padding: 4px 8px !important; }
.inc-upload-file-info svg { flex-shrink: 0; }

/* KPI */
.incentive-kpi { margin-bottom: 0; }
.incentive-kpi .kpi-value {
  font-size: 17px !important;
  word-break: break-all;
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-tertiary, #9CA3AF);
  margin-top: 2px;
}

/* ===== 결과 테이블 ===== */
#incentiveTable {
  font-size: 12px;
  table-layout: fixed;
  width: 100%;
  min-width: 820px;
}
#incentiveTable th,
#incentiveTable td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 8px 6px;
}
#incentiveTable th:nth-child(1), #incentiveTable td:nth-child(1) { width: 70px; }
#incentiveTable th:nth-child(2), #incentiveTable td:nth-child(2) { width: 90px; }
#incentiveTable th:nth-child(3), #incentiveTable td:nth-child(3) { width: 110px; }
#incentiveTable th:nth-child(4), #incentiveTable td:nth-child(4) { width: 80px; }
#incentiveTable th:nth-child(5), #incentiveTable td:nth-child(5) { width: 80px; }
#incentiveTable th:nth-child(6), #incentiveTable td:nth-child(6) { width: 80px; }
#incentiveTable th:nth-child(7), #incentiveTable td:nth-child(7) { width: 80px; }
#incentiveTable th:nth-child(8), #incentiveTable td:nth-child(8) { width: 90px; }
#incentiveTable th:nth-child(9), #incentiveTable td:nth-child(9) { width: 100px; }

#page-inc-analysis .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#page-inc-analysis .section-toolbar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
}
#page-inc-analysis .toolbar-actions { display: flex; gap: 8px; }

/* 울트라콜 입력 */
.ultracall-input {
  width: 100%; max-width: 80px;
  padding: 4px 6px;
  border: 1px solid var(--border-light, #E5E7EB);
  border-radius: 6px;
  font-size: 12px;
  text-align: right;
  background: var(--bg-primary, #fff);
  color: var(--text-primary);
  transition: border-color 0.15s;
}
.ultracall-input:focus {
  outline: none;
  border-color: var(--blue, #3B82F6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.ultracall-input::-webkit-inner-spin-button,
.ultracall-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ultracall-input { -moz-appearance: textfield; }

.inc-total { color: var(--blue, #1E40AF); }

/* ===== 대시보드: 유형별 비중 ===== */
.inc-type-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; font-size: 12px;
}
.inc-type-label {
  width: 60px; flex-shrink: 0;
  display: flex; align-items: center; gap: 4px;
  color: var(--text-secondary); font-weight: 500;
}
.inc-type-label i {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 2px;
}
.inc-type-bar-wrap {
  flex: 1; height: 18px;
  background: var(--bg-secondary, #F1F5F9);
  border-radius: 4px; overflow: visible;
  position: relative;
}
.inc-type-bar {
  height: 100%; border-radius: 4px;
  transition: width 0.3s ease;
  position: relative; cursor: default;
}
.inc-type-bar::after {
  content: attr(data-label);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: rgba(15,23,42,0.92); color: #fff;
  font-size: 11px; font-weight: 500;
  padding: 4px 8px; border-radius: 6px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.15s; z-index: 10;
}
.inc-type-bar:hover::after { opacity: 1; }
.inc-type-val {
  width: 140px; flex-shrink: 0;
  text-align: right; font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.inc-type-pct {
  color: var(--text-tertiary); font-weight: 400;
}

/* ===== 대시보드: 기준 달성 현황 ===== */
.inc-threshold-item {
  margin-bottom: 40px;
}
.inc-threshold-label {
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 8px;
}
.inc-threshold-label strong {
  color: var(--text-primary);
}
.inc-threshold-track {
  position: relative;
  height: 20px;
  background: var(--bg-secondary, #F1F5F9);
  border-radius: 6px;
  overflow: visible;
}
.inc-threshold-fill {
  height: 100%;
  background: linear-gradient(90deg, #3B82F6, #60A5FA);
  border-radius: 6px;
  transition: width 0.3s ease;
  position: relative; cursor: default;
}
.inc-threshold-fill::after {
  content: attr(data-label);
  position: absolute; bottom: calc(100% + 6px); right: 0;
  background: rgba(15,23,42,0.92); color: #fff;
  font-size: 11px; font-weight: 500;
  padding: 4px 8px; border-radius: 6px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.15s; z-index: 10;
}
.inc-threshold-fill:hover::after { opacity: 1; }
.inc-threshold-mark {
  position: absolute; top: 0; height: 100%;
  transform: translateX(-50%);
}
.inc-threshold-tick {
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 2px; height: calc(100% + 8px);
  background: var(--text-tertiary, #9CA3AF);
  opacity: 0.5;
}
.inc-threshold-mark.reached .inc-threshold-tick {
  background: var(--green, #059669);
  opacity: 1;
}
.inc-threshold-text {
  position: absolute; top: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  font-size: 10px; color: var(--text-tertiary);
  text-align: center; line-height: 1.3;
  white-space: nowrap;
}
.inc-threshold-desc {
  font-size: 9px; font-weight: 400;
  opacity: 0.8;
}
.inc-threshold-mark.reached .inc-threshold-text {
  color: var(--green, #059669); font-weight: 600;
}

/* ===== 대시보드: 직원별 바 차트 ===== */
.inc-legend {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; font-size: 12px; color: var(--text-secondary);
}
.inc-legend i {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 2px; margin-right: 4px; vertical-align: -1px;
}

.inc-bar-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.inc-bar-name {
  width: 56px; flex-shrink: 0;
  font-size: 12px; font-weight: 600;
  text-align: right; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.inc-bar-track {
  flex: 1; display: flex; height: 24px;
  background: var(--bg-secondary, #F1F5F9);
  border-radius: 6px;
  position: relative;
}
.inc-bar-seg {
  height: 100%;
  transition: width 0.3s ease;
  min-width: 2px;
  position: relative;
  cursor: default;
}
.inc-bar-seg:first-child { border-radius: 6px 0 0 6px; }
.inc-bar-seg:last-child { border-radius: 0 6px 6px 0; }

/* 호버 툴팁 */
.inc-bar-seg::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}
.inc-bar-seg:hover::after {
  opacity: 1;
}
.inc-bar-total {
  width: 80px; flex-shrink: 0;
  font-size: 12px; font-weight: 600;
  text-align: right; color: var(--text-primary);
  white-space: nowrap;
}

/* ===== 직원별 페이지 ===== */
#incEmployeesContent {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.inc-emp-card { margin-bottom: 0; }
.inc-emp-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.inc-emp-name {
  font-size: 15px; color: var(--text-primary);
}
.inc-emp-part {
  font-size: 12px; color: var(--text-tertiary);
  margin-left: 6px;
}
.inc-emp-total {
  font-size: 16px; font-weight: 700;
  color: var(--blue, #3B82F6);
}
.inc-emp-revenue {
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light, #E5E7EB);
}
.inc-emp-bars {
  display: flex; flex-direction: column; gap: 6px;
}
.inc-emp-bar-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
}
.inc-emp-bar-label {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-secondary);
}
.inc-emp-bar-label i {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 2px;
}
.inc-emp-bar-val {
  font-weight: 600; color: var(--text-primary);
}

/* ===== 제품별 페이지 ===== */
#incProductsContent .table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
#incProductsContent table {
  min-width: 700px;
  table-layout: auto;
}
#incProductsContent th,
#incProductsContent td {
  white-space: nowrap; padding: 7px 10px;
}
#incProductsContent .col-num {
  width: auto;
  min-width: 100px;
  padding: 7px 10px;
}

/* 비율 배지 */
.rate-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
}
.rate-10 {
  background: #DBEAFE; color: #1D4ED8;
}
.rate-15 {
  background: #FEF3C7; color: #B45309;
}

/* 인센데이터 상태 */
.inc-data-status {
  font-weight: 500;
}

/* ===== 정렬 버튼 ===== */
.inc-sort-btns {
  display: inline-flex;
  gap: 2px;
  background: var(--bg-secondary, #F1F5F9);
  border-radius: 8px;
  padding: 2px;
}
.inc-sort-btn {
  padding: 4px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary, #9CA3AF);
  cursor: pointer;
  transition: all 0.15s;
}
.inc-sort-btn:hover {
  color: var(--text-primary);
}
.inc-sort-btn.active {
  background: var(--bg-primary, #fff);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 직원별 페이지 정렬 */
.inc-emp-sort-wrap {
  grid-column: 1 / -1;
  margin-bottom: 4px;
}

/* ===== 제품명 입력 ===== */
.product-name-input {
  width: 100%;
  max-width: 200px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 12px;
  background: transparent;
  color: var(--text-primary);
  transition: border-color 0.15s, background 0.15s;
}
.product-name-input:hover {
  border-color: var(--border-light, #E5E7EB);
  background: var(--bg-primary, #fff);
}
.product-name-input:focus {
  outline: none;
  border-color: var(--blue, #3B82F6);
  background: var(--bg-primary, #fff);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* 비율 드롭다운 */
.rate-select {
  padding: 2px 4px;
  border: 1px solid var(--border-light, #E5E7EB);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-primary, #fff);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s;
}
.rate-select:focus {
  outline: none;
  border-color: var(--blue, #3B82F6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* 울트라콜 readonly 스타일 */
.ultracall-input[readonly] {
  border-color: transparent;
  background: transparent;
  cursor: default;
}
.ultracall-input[readonly]:hover {
  border-color: transparent;
}
.ultracall-input.editing {
  border-color: var(--blue, #3B82F6);
  background: var(--bg-primary, #fff);
}

/* 울트라콜 수정 버튼 */
#ultracallEditBtn {
  font-size: 12px;
  padding: 4px 12px;
}
#ultracallEditBtn.active {
  background: var(--blue, #3B82F6);
  color: #fff;
  border-color: var(--blue, #3B82F6);
}

/* 카드 헤더 flex-wrap (sort 버튼과 제목이 나란히 표시되도록) */
#incProductsContent .card-header,
#incEmployeeChart .inc-sort-btns {
  flex-wrap: wrap;
  gap: 8px;
}
#incEmployeeChart .inc-sort-btns {
  margin-bottom: 12px;
}

/* ===== 반응형 ===== */
@media (max-width: 768px) {
  .incentive-kpi { grid-template-columns: 1fr 1fr; }
  #incentiveTable { font-size: 11px; }
  .inc-bar-name { width: 44px; font-size: 11px; }
  .inc-bar-total { width: 64px; font-size: 11px; }
  #incEmployeesContent { grid-template-columns: 1fr; }
  .inc-type-val { width: 100px; font-size: 11px; }
}
@media (max-width: 480px) {
  .incentive-kpi { grid-template-columns: 1fr; }
}
