/* ═══════════════════════════════════════════════════════════ */
/* WSM (도매처 관리) — wsm- 접두사                              */
/* ═══════════════════════════════════════════════════════════ */

/* 꽉찬 화면 (기본 .page의 max-width:980px 해제) */
#page-wsm-catalog,
#page-wsm-portfolio { max-width: none; padding: 16px 20px; }

.wsm-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.wsm-empty-tabs {
  font-size: 13px;
  color: var(--text3);
  padding: 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  width: 100%;
}

.wsm-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  border-radius: 4px 4px 0 0;
  transition: background .12s, color .12s;
}
.wsm-tab:hover {
  background: var(--surface2);
  color: var(--text);
}
.wsm-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--accent-light);
  font-weight: 700;
}
.wsm-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 0 6px;
  height: 18px;
  background: var(--surface2);
  color: var(--text3);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.wsm-tab.active .wsm-tab-count {
  background: var(--accent);
  color: #fff;
}
.wsm-tab-edit {
  margin-left: 4px;
  font-size: 11px;
  cursor: pointer;
  opacity: .6;
}
.wsm-tab-edit:hover {
  opacity: 1;
}

.wsm-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.wsm-content-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.wsm-supplier-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.wsm-supplier-sub {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}
.wsm-content-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.wsm-empty-content {
  font-size: 13px;
  color: var(--text3);
  padding: 24px;
  text-align: center;
}

.wsm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.wsm-table thead th {
  background: var(--surface2);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.wsm-table tbody td,
.wsm-table tfoot td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.wsm-table tbody tr:hover {
  background: #f9fafb;
}
.wsm-table tfoot td {
  border-top: 2px solid var(--border);
}
.wsm-table code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 3px;
}
.wsm-unmatched {
  color: var(--red, #dc2626);
  font-size: 12px;
  font-style: italic;
}

.wsm-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: 6px;
  margin-bottom: 8px;
}

.wsm-warn {
  font-size: 12px;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 10px;
  line-height: 1.6;
}
.wsm-warn code {
  margin-right: 4px;
}

/* 판매량 분석 — 탭 버튼 (밑줄형) */
.wsm-sales-tab {
  padding: 8px 14px;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -9px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
  transition: all 0.12s ease;
}
.wsm-sales-tab:hover { color: var(--text); background: var(--bg2); border-radius: 4px 4px 0 0; }
.wsm-sales-tab.active {
  color: var(--primary, #2563eb);
  border-bottom-color: var(--primary, #2563eb);
  font-weight: 700;
  background: transparent;
}

/* 판매량 분석 — 필터 input 통일 */
.wsm-sales-filters .form-input {
  height: 32px;
  font-size: 13px;
  padding: 4px 8px;
}
.wsm-sales-date { width: 130px; }
.wsm-sales-icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 판매량 분석 — 기간 프리셋 chip */
.wsm-sales-preset {
  padding: 5px 10px;
  border: none;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  color: var(--text2);
  transition: all 0.12s ease;
  border-right: 1px solid var(--border);
}
.wsm-sales-preset:last-child { border-right: none; }
.wsm-sales-preset:hover { background: var(--bg2); }
.wsm-sales-preset.active {
  background: var(--primary, #2563eb);
  color: #fff;
  font-weight: 600;
}

/* 월별 추이 — 메트릭 토글 */
.wsm-metric-btn {
  padding: 6px 14px;
  border: none;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  transition: all 0.12s ease;
}
.wsm-metric-btn:not(:last-child) { border-right: 1px solid var(--border); }
.wsm-metric-btn:hover { background: var(--bg2); }
.wsm-metric-btn.active {
  background: var(--primary, #2563eb);
  color: #fff;
  font-weight: 600;
}

/* 처리 대기 탭 — 거래처 탭들 맨 앞 위치, 노란 강조 */
.wsm-tab.wsm-tab-pending {
  background: #fef3c7;
  border-color: #fbbf24;
  color: #78350f;
  font-weight: 600;
}
.wsm-tab.wsm-tab-pending:hover { background: #fde68a; }
.wsm-tab.wsm-tab-pending.active {
  background: #d97706;
  color: #fff;
  border-color: #b45309;
}
.wsm-tab-count.wsm-tab-count-pending {
  background: #d97706;
  color: #fff;
}
.wsm-tab.wsm-tab-pending.active .wsm-tab-count-pending {
  background: #fff;
  color: #d97706;
}

/* ERP 양식 변환 — 드래그&드롭 시각 피드백 */
#page-wsm-erp-convert {
  position: relative;
  transition: background-color 0.15s ease;
}
#page-wsm-erp-convert.wsm-erp-drop-hover {
  background: rgba(124, 58, 237, 0.06);
  outline: 2px dashed rgba(124, 58, 237, 0.5);
  outline-offset: -8px;
}
#page-wsm-erp-convert.wsm-erp-drop-hover::after {
  content: '여기에 놓아 업로드';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(124, 58, 237, 0.95);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  pointer-events: none;
  z-index: 10;
}
