/* 공급사 관리 페이지 PC용 스타일 */

/* 기본 placeholder 스타일 */
.placeholder-content {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.placeholder-content h3 {
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.placeholder-content p {
    margin-bottom: 1.5rem;
    color: #6b7280;
}

/* 기본 레이아웃 */
.supplier-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    color: white;
    font-family: 'Pretendard Variable', sans-serif;
}

.supplier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.supplier-content {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    color: #333;
    min-height: 600px;
}

.supplier-section h2 {
    margin-bottom: 1.5rem;
    color: #667eea;
    font-size: 1.5rem;
    font-weight: 600;
}

/* 공급사 입력 섹션 */
.supplier-input-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    border: 2px solid #e5e7eb;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#supplierIdInput {
    padding: 0.75rem 1rem;
    border: 2px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    min-width: 250px;
    transition: border-color 0.3s ease;
}

#supplierIdInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.column-management {
    display: flex;
    gap: 0.5rem;
}

/* 필터 섹션 스타일 */
.supplier-filter-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
    padding: 0.25rem 1rem;
    background: transparent;
    border: none;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

/* 사업자 콤보박스 */
.business-select-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.active-biz-indicator {
    display: none;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4338ca;
    background: #e0e7ff;
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    white-space: nowrap;
}

#businessSelect {
    padding: 0.35rem 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    color: #374151;
    background: white;
    cursor: pointer;
    min-width: 120px;
    transition: border-color 0.2s ease;
}

#businessSelect:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* 통합 칩 바 */
.filter-chip-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* 칩 좌측 네모 색상 인디케이터 */
.chip-color-box {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 0.25rem;
    vertical-align: middle;
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    background: #f3f4f6;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    color: #374151;
    user-select: none;
    border: 1px solid transparent;
}

.stat-chip:hover {
    background: #e5e7eb;
}

/* 가공상태 칩 active */
.stat-chip.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}
.stat-chip.active .chip-color-box {
    background: white !important;
}

.stat-chip-progress.active {
    background: #f59e0b;
    border-color: #f59e0b;
    color: white;
}

.stat-chip-completed.active {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.stat-chip-blacklist.active {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

/* 평가 칩 active */
.stat-chip-like.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.stat-chip-normal.active {
    background: #6b7280;
    border-color: #6b7280;
    color: white;
}

.stat-chip-dislike.active {
    background: #f97316;
    border-color: #f97316;
    color: white;
}

.stat-chip-norating.active {
    background: #a78bfa;
    border-color: #a78bfa;
    color: white;
}

/* 전체 칩 */
.stat-chip-all {
    font-weight: 500;
}

.stat-divider {
    color: #d1d5db;
    font-size: 0.75rem;
}


/* 사업자 관리 모달 */
.business-add-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.business-add-row input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.9rem;
}

.business-add-row input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.business-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.business-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    margin-bottom: 0.4rem;
    transition: background 0.2s ease;
}

.business-list-item:hover {
    background: #f9fafb;
}

.business-drag-handle {
    cursor: grab;
    color: #9ca3af;
    font-size: 1.1rem;
    user-select: none;
    margin-right: 0.4rem;
    line-height: 1;
}
.business-drag-handle:active { cursor: grabbing; }
.business-order-num {
    font-size: 0.75rem;
    color: #9ca3af;
    min-width: 1.2em;
    text-align: center;
    margin-right: 0.5rem;
}
.business-list-item.dragging { opacity: 0.4; }
.business-list-item.drag-over { border-color: #667eea; background: #eef2ff; }
.business-name {
    flex: 1;
    font-size: 0.9rem;
    color: #374151;
    font-weight: 500;
}

.business-item-actions {
    display: flex;
    gap: 0.25rem;
}

.business-item-actions button {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: background 0.2s ease;
}

.business-item-actions button:hover {
    background: #f3f4f6;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* 일괄 처리 버튼 비활성화 스타일 */
.bulk-action-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 일괄 처리 버튼 활성화 스타일 (그룹묶기와 동일) */
#bulkRefreshBtn:not(.bulk-action-disabled),
#bulkDeleteBtn:not(.bulk-action-disabled) {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

#bulkRefreshBtn:not(.bulk-action-disabled):hover,
#bulkDeleteBtn:not(.bulk-action-disabled):hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}


/* 그룹 버튼 비활성화 */
.group-button-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 테이블 래퍼 */
.table-wrapper {
    position: relative;
    max-height: 70vh;
    overflow: auto;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    background: white;
}

/* 테이블 스타일 */
.supplier-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.77rem;
    background: white;
    table-layout: fixed;
}

.supplier-table thead {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #f8fafc;
}

.supplier-table th {
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    background: #f8fafc;
    position: relative;
    min-width: 70px;
    white-space: nowrap;
}

/* 기본 컬럼 너비 설정 (체크박스 추가로 인한 인덱스 조정) */

.supplier-table th:nth-child(1) { 
    width: 40px;
    position: sticky;
    left: 0;
    top: 0;
    z-index: 25;  /* thead보다 높게 */
    background: #f8fafc;
    border-right: 2px solid #e5e7eb;  /* 고정열 구분 */
}

.supplier-table th:nth-child(2) { width: 50px; }   /* 순번 */
.supplier-table th:nth-child(3) { width: 62px; }   /* 점수 */
.supplier-table th:nth-child(4) { width: 150px; }  /* 공급사ID */
.supplier-table th:nth-child(5) { width: 120px; }  /* 닉네임 */
.supplier-table th:nth-child(6) { width: 90px; }   /* 평균단가 */
.supplier-table th:nth-child(7) { width: 70px; }   /* 상품수 */
.supplier-table th:nth-child(8) { width: 70px; }   /* 출고속도 */
.supplier-table th:nth-child(9) { width: 70px; }   /* 묶음배송 */
.supplier-table th:nth-child(10) { width: 90px; }  /* 평균배송비 */
.supplier-table th:nth-child(11) { width: 50px; }  /* 등급 */
.supplier-table th:nth-child(12) { width: 120px; } /* 사업자명 */
.supplier-table th:nth-child(13) { width: 280px; } /* 사업장주소/반품주소 */
.supplier-table th:nth-child(14) { width: 120px; } /* 연락처 */
.supplier-table th:nth-child(15) { width: 150px; } /* API업데이트 */


/* 전체 선택 체크박스 스타일 - */
#selectAllCheckbox {
    cursor: pointer;
    transform: scale(1.1);
}

#selectAllCheckbox:indeterminate {
    opacity: 0.7;
}

.supplier-table th:last-child {
    border-right: none;
}

/* 정렬 기능 스타일 */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.sortable:hover {
    background: #e2e8f0 !important;
}

.sort-icon {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.8rem;
    color: #9ca3af;
    transition: color 0.2s ease;
}

.sortable.sorted-asc {
    background: #dbeafe !important;
    color: #1e40af !important;
}

.sortable.sorted-desc {
    background: #fef3c7 !important;
    color: #d97706 !important;
}

.sortable.sorted-asc .sort-icon,
.sortable.sorted-desc .sort-icon {
    color: inherit;
    font-weight: bold;
}

/* 기본 컬럼 스타일 */
.basic-column {
    background: #f1f5f9 !important;
}

/* 컬럼 리사이저 */
.resizable {
    position: relative;
}

.column-resizer {
    position: absolute;
    top: 0;
    right: -2px;
    width: 5px;
    height: 100%;
    background: transparent;
    cursor: col-resize;
    z-index: 10;
}

.column-resizer:hover {
    background: rgba(102, 126, 234, 0.3);
}

.column-resizer:active {
    background: rgba(90, 103, 216, 0.5);
}

/* 테이블 바디 */
.supplier-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #f3f4f6;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.supplier-table td:last-child {
    border-right: none;
}

/* 체크박스 컬럼만 좌측 고정 */
.supplier-table td:nth-child(1) {
    position: sticky;
    left: 0;
    z-index: 15;
    background: white;
    border-right: 2px solid #f3f4f6;
}

/* 체크박스 행 상태별 배경색 */
.supplier-table tr:hover td:nth-child(1) {
    background: #f8fafc;
}

.group-main-row td:nth-child(1) {
    background: #f0f9ff !important;
}

.group-member-row td:nth-child(1) {
    background: #f8fafc !important;
}

.selection-state td:nth-child(1) {
    background: #dbeafe !important;
}

.supplier-table tr.highlight td:nth-child(1) {
    background: #fef3c7 !important;
}



/* 사업장주소/반품주소 컬럼 - 각각 한 줄씩 표시 */
.supplier-table td:nth-child(13) {
    white-space: normal;
    line-height: 1.2;
    padding: 0.5rem 0.75rem;
}

/* 사업장주소 (첫 번째 줄) */
.supplier-table td:nth-child(13) .company-addr {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* 반품주소 (두 번째 줄) */
.supplier-table td:nth-child(13) .return-addr {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.supplier-table tr:hover {
    background: #f8fafc;
}

/* 강조 효과 */
.supplier-table tr.highlight {
    background: #fef3c7 !important;
    animation: highlightFade 2s ease-in-out;
}

@keyframes highlightFade {
    0% { background: #fbbf24; }
    100% { background: #fef3c7; }
}

/* 그룹 관련 스타일 */
.selection-state {
    background: #dbeafe !important;
    border-left: 4px solid #3b82f6;
}

.group-main-row {
    background-color: #f0f9ff !important;
}

.group-member-row {
    background-color: #f8fafc !important;
    border-left: 4px solid #e2e8f0;
}

/* 그룹 아이콘 스타일 */
.group-icon {
    cursor: pointer;
    margin-right: 0.25rem;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.group-icon:hover {
    transform: scale(1.1);
}

/* 공급사 아이콘 스타일 */
.supplier-icons {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.25rem;
    font-size: 0.9rem;
}

.supplier-icon {
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
}

.supplier-icon:hover {
    background-color: #f3f4f6;
    transform: scale(1.1);
}

.icon-remove:hover {
    background-color: #fef3c7;
    color: #d97706;
}

.supplier-rating-icon {
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
}



/* 특수 셀 스타일 */
.date-cell {
    color: #6b7280;
}

.empty-message {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 3rem !important;
}


/* 그룹 생성 모달 스타일 */
.group-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.group-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1);
    min-width: 400px;
}

.group-modal h3 {
    margin: 0 0 1.5rem 0;
    color: #374151;
    font-size: 1.25rem;
}

.group-modal-field {
    margin-bottom: 1rem;
}

.group-modal-field input,
.group-modal-field select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-size: 0.9rem;
}

.group-modal-field input:focus,
.group-modal-field select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.group-modal-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.group-modal-buttons button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.group-modal-buttons .btn-primary {
    background: #667eea;
    color: white;
}

.group-modal-buttons .btn-primary:hover {
    background: #5a67d8;
}

.group-modal-buttons .btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.group-modal-buttons .btn-secondary:hover {
    background: #e5e7eb;
}


/* 컬러바 상태 표시 (행 좌측 4px 바) — 단일 사업자 fallback */
.status-bar-progress {
    border-left: 4px solid #f59e0b !important;
}
.status-bar-completed {
    border-left: 4px solid #10b981 !important;
}
.status-bar-blacklist {
    border-left: 4px solid #ef4444 !important;
}

/* 다중 사업자 컬러바 */
.has-multi-bar {
    border-left: none !important;
}
.has-multi-bar > td:first-child {
    position: relative;
}
.multi-status-bar {
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.multi-status-bar .bar-seg {
    flex: 1;
    border-radius: 1px;
}
.bar-seg-progress { background: #f59e0b; }
.bar-seg-completed { background: #10b981; }
.bar-seg-blacklist { background: #ef4444; }
.bar-seg-none { background: #e5e7eb; }
.bar-seg-active {
    outline: 1px solid rgba(0,0,0,0.2);
    outline-offset: -1px;
}

/* 5개 이상 사업자 초과 뱃지 */
.extra-biz-badge {
    display: inline-block;
    font-size: 10px;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 3px;
    padding: 0 3px;
    margin-left: 2px;
    vertical-align: middle;
    cursor: default;
}


/* 미리보기 카드 */
.preview-card {
    background: #fffbeb;
    border: 2px solid #f59e0b;
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.preview-card-header {
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: #92400e;
    display: flex;
    align-items: center;
}

.preview-score-sep {
    margin: 0 8px;
    color: #d1d5db;
    font-weight: 300;
}

.preview-score-badge.score-badge {
    font-size: 12px;
    padding: 1px 7px;
    margin: 0 5px;
}

.preview-card-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.4rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
}

.preview-card-info dl {
    margin: 0;
    display: flex;
    gap: 0.4rem;
    align-items: baseline;
}

.preview-card-info dt {
    color: #6b7280;
    white-space: nowrap;
}

.preview-card-info dd {
    margin: 0;
    font-weight: 500;
    color: #374151;
}

.preview-card-addr {
    font-size: 0.78rem;
    color: #374151;
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.preview-card-addr .addr-label {
    display: inline-block;
    width: 45px;
    color: #6b7280;
    font-weight: 500;
}

.preview-warning {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
}

.preview-warning-title {
    color: #dc2626;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.preview-match-item {
    padding: 0.25rem 0;
    color: #374151;
}

.preview-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.preview-btn-add {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea !important;
}

.preview-btn-add:hover {
    background: #5a67d8 !important;
}

.preview-btn-group {
    background: #10b981 !important;
    color: white !important;
    border-color: #10b981 !important;
}

.preview-btn-group:hover {
    background: #059669 !important;
}

/* 중복 스캔 모달 */
.scan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.scan-header h3 {
    margin: 0;
}

.scan-cluster {
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.scan-reason {
    font-size: 0.75rem;
    color: #dc2626;
    font-weight: 600;
    white-space: nowrap;
    min-width: 80px;
}

.scan-members {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.scan-member {
    font-size: 0.75rem;
    background: #f3f4f6;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    color: #374151;
}

.scan-action {
    white-space: nowrap;
}

.scan-grouped {
    font-size: 0.75rem;
    color: #10b981;
    font-weight: 500;
}

/* 로딩 오버레이 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    border-radius: 0.5rem;
}

.loading-spinner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 2px solid #667eea;
    color: #667eea;
    font-weight: 600;
}

.loading-spinner::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 스크롤바 스타일 */
.table-wrapper::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 7px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 7px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 테이블 고정 헤더 그림자 */
.supplier-table thead::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1), transparent);
    pointer-events: none;
}

/* 모바일용 요소들 숨김 */
.mobile-card-container,
.mobile-column-management,
.mobile-add-column {
    display: none;
}

/* ==================== 상품소싱 모달 ==================== */

/* 모달 사이즈 오버라이드 */
.modal-sourcing {
    --font-xs: 0.8rem;
    --font-2xs: 0.7rem;
    --row-height: 26px;
    max-width: 1100px;
    width: 95%;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-sourcing .modal-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.sourcing-cache-info {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: normal;
    flex-shrink: 0;
}

/* 설정 영역 */
.sourcing-settings {
    padding: 0 1rem;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.sourcing-settings-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0;
    font-size: var(--font-xs);
    color: var(--text-primary);
    line-height: 1;
    min-height: 28px;
}


.sourcing-settings-row + .sourcing-settings-row {
    border-top: 1px solid var(--gray-100);
}

/* 설정 그룹 구분선 */
.sourcing-settings-row .setting-divider {
    width: 1px;
    height: 16px;
    background: var(--gray-300);
    flex-shrink: 0;
    margin: 0 0.15rem;
}

.setting-label {
    font-size: var(--font-sm);
    flex-shrink: 0;
    line-height: 1;
}

.setting-sep {
    color: var(--text-muted);
    line-height: 1;
}

.setting-unit {
    font-size: var(--font-xs);
    color: var(--text-secondary);
    margin-right: 0.25rem;
    line-height: 1;
}

.price-input {
    width: 80px;
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    color: var(--text-primary);
    height: var(--row-height, 24px);
    box-sizing: border-box;
}

.price-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.setting-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--font-xs);
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
    height: var(--row-height, 24px);
}

.setting-checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    vertical-align: middle;
}

.setting-checkbox span {
    line-height: 1;
}

/* 유사도 슬라이더 */
.similarity-slider-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    position: relative;
}

.similarity-slider-wrap input[type="range"] {
    width: 100px;
    height: 4px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.slider-value {
    font-size: var(--font-xs);
    color: var(--primary-color);
    font-weight: 600;
    min-width: 2.2em;
}

.slider-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: var(--text-inverse);
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

.slider-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--gray-800);
}

.similarity-slider-wrap:hover .slider-tooltip,
.similarity-slider-wrap:focus-within .slider-tooltip {
    display: block;
}

/* 정렬 드롭다운 */
.sort-select {
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    height: var(--row-height, 24px);
    box-sizing: border-box;
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 뷰 토글 */
.sourcing-view-toggle {
    display: inline-flex;
    gap: 2px;
}

.sourcing-view-toggle .view-btn {
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--gray-200);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    font-size: var(--font-xs);
    transition: all var(--transition-fast);
    height: var(--row-height, 24px);
    box-sizing: border-box;
    line-height: 1;
}

.sourcing-view-toggle .view-btn:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.sourcing-view-toggle .view-btn:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sourcing-view-toggle .view-btn.active {
    background: var(--primary-color);
    color: var(--text-inverse);
    border-color: var(--primary-color);
}

/* 결과행 액션 버튼 통일 */
#sourcingCopyNumbers,
#sourcingMacroNyang,
#sourcingHistoryBtn {
    padding: 0.2rem 0.6rem;
    font-size: var(--font-xs);
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-300);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    height: var(--row-height, 24px);
    box-sizing: border-box;
    line-height: 1;
}

#sourcingCopyNumbers {
    margin-left: auto;
}

#sourcingMacroNyang {
    background: var(--primary-color);
    color: var(--text-inverse);
    border-color: var(--primary-color);
}

#sourcingMacroNyang:hover {
    opacity: 0.85;
}

#sourcingCopyNumbers:hover,
#sourcingHistoryBtn:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.sourcing-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.sourcing-progress.active {
    opacity: 1;
}

.sourcing-progress .progress-bar {
    width: 100%;
    height: 100%;
    background: var(--gray-200);
    border-radius: 1px;
    overflow: hidden;
}

.sourcing-progress .progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    width: 0;
}

/* 상품 목록 본문 */
.sourcing-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem;
    min-height: 0;
}

.sourcing-body::-webkit-scrollbar {
    width: 12px;
}

.sourcing-body::-webkit-scrollbar-track {
    background: transparent;
}

.sourcing-body::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.sourcing-body::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
    background-clip: padding-box;
}

/* 상품 아이템 - 리스트 모드 (배지 스타일) */
.sourcing-item {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--gray-100);
    gap: 0.5rem;
    font-size: var(--font-xs);
    min-height: 36px;
    transition: background var(--transition-fast);
}

.sourcing-item:hover {
    background: var(--gray-50);
}

.sourcing-item:last-child {
    border-bottom: none;
}

.sourcing-item .sourcing-checkbox {
    flex-shrink: 0;
    cursor: pointer;
}

.sourcing-item .item-seq {
    flex-shrink: 0;
    min-width: 1.8em;
    text-align: right;
    color: var(--text-muted);
    font-size: var(--font-2xs, 0.65rem);
}

.sourcing-item .item-no {
    flex-shrink: 0;
    color: var(--gray-400);
    font-size: var(--font-2xs, 0.65rem);
    min-width: 5em;
}

.sourcing-item .item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.sourcing-item .item-price {
    white-space: nowrap;
    font-weight: 600;
    color: var(--primary-color);
    flex-shrink: 0;
}

/* 그룹 배지 [N] */
.group-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: var(--text-inverse);
    font-size: var(--font-2xs, 0.65rem);
    font-weight: 700;
    min-width: 1.5em;
    height: 1.5em;
    padding: 0 0.3em;
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    user-select: none;
}

.group-badge:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.group-badge.expanded {
    background: var(--secondary-color);
}

/* 그룹 멤버 (들여쓰기 + 연결선) */
.sourcing-item.group-member {
    padding-left: 2.2rem;
    position: relative;
    background: var(--gray-50);
    font-size: var(--font-2xs, 0.7rem);
}

.sourcing-item.group-member:hover {
    background: var(--gray-100);
}

.sourcing-item.group-member::before {
    content: '';
    position: absolute;
    left: 1.1rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-300);
}

.sourcing-item.group-member::after {
    content: '';
    position: absolute;
    left: 1.1rem;
    top: 50%;
    width: 0.6rem;
    height: 2px;
    background: var(--gray-300);
}

.sourcing-item.group-member:last-child::before {
    bottom: 50%;
}

/* 상품 아이템 - 썸네일 모드 */
.sourcing-item.thumb-mode {
    min-height: 62px;
}

.sourcing-item.thumb-mode .item-thumb {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

/* 페이지네이션 */
.sourcing-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.sourcing-pagination:empty {
    display: none;
}

.page-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    font-size: var(--font-xs);
    min-width: 2em;
    text-align: center;
    transition: all var(--transition-fast);
}

.page-btn.active {
    background: var(--primary-color);
    color: var(--text-inverse);
    border-color: var(--primary-color);
}

.page-btn:hover:not(.active) {
    background: var(--gray-100);
}

/* 소싱 아이콘 */
.icon-sourcing {
    cursor: pointer;
}

.icon-sourcing:hover {
    transform: scale(1.2);
}

/* 금지단어 버튼 (소싱 설정 내) */
.btn-banned-words {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.25rem;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: var(--font-xs);
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    height: var(--row-height, 24px);
    box-sizing: border-box;
}

.btn-banned-words:hover {
    border-color: var(--danger-color, #ef4444);
    color: var(--danger-color, #ef4444);
}

.btn-banned-words.has-words {
    border-color: var(--danger-color, #ef4444);
    color: var(--danger-color, #ef4444);
    background: #fef2f2;
}


/* 금지단어 관리 모달 */
#bannedWordsModal {
    z-index: 2100;
}

.modal-banned-words {
    width: 480px;
    max-width: 95vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.banned-words-body {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
}

.banned-words-input-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.banned-word-input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.25rem;
    font-size: var(--font-sm);
}

.banned-word-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.banned-words-info {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.banned-words-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-height: 2rem;
}

.banned-word-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.5rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 1rem;
    font-size: var(--font-xs);
    color: #dc2626;
}

.banned-word-tag .remove-word {
    cursor: pointer;
    font-size: 0.9em;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.banned-word-tag .remove-word:hover {
    opacity: 1;
}

.banned-words-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--gray-200);
}

.banned-filtered-count {
    font-size: var(--font-xs);
    color: var(--text-muted);
}


/* 소싱 빈 상태 */
.sourcing-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.sourcing-empty .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

/* 소싱 모달 모바일 반응형 */
@media (max-width: 768px) {
    .modal-sourcing {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .sourcing-settings-row {
        gap: 0.3rem;
        flex-wrap: wrap;
    }

    .price-input {
        width: 60px;
    }

    .similarity-slider-wrap input[type="range"] {
        width: 70px;
    }

    .sourcing-item .item-seq,
    .sourcing-item .item-no {
        display: none;
    }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    /* 기본 폰트 크기 축소 */
    .supplier-page {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .supplier-header {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .supplier-header h2 {
        font-size: 1.5rem;
        margin: 0;
    }
    
    .supplier-content {
        padding: 0.75rem;
        border-radius: 0.75rem;
    }
    
    /* 입력 섹션 모바일 최적화 */
    .supplier-input-section {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .input-group {
        flex-direction: row;  /* column → row로 변경 */
        gap: 0.5rem;
        width: 100%;
        align-items: stretch;  /* 높이 맞춤 */
    }

    #supplierIdInput {
        min-width: auto;
        flex: 1;
        font-size: 0.9rem;
        padding: 0.6rem 0.8rem;
    }
    
    .column-management {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        justify-content: center;
    }
    
    /* 필터 섹션 모바일 조정 */
    .supplier-filter-section {
        padding: 0.5rem 0.75rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    #businessSelect {
        width: 100%;
        font-size: 0.75rem;
    }

    .filter-chip-bar {
        gap: 0.3rem;
    }

    .stat-chip {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }

    /* 버튼 크기 조정 */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
    
    .btn-small {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
    
    /* 테이블 모바일 최적화 */
    .table-wrapper {
        max-height: 60vh;
        border-radius: 0.5rem;
    }
    
    .supplier-table {
        font-size: 0.7rem;
    }
    
    .supplier-table th,
    .supplier-table td {
        padding: 0.4rem 0.3rem;
        min-width: 60px;
    }
    
    .supplier-table th {
        font-size: 0.65rem;
    }
    
    /* 컬럼 너비 모바일용 조정 */

    .supplier-table th:nth-child(1) { 
        width: 30px;
        position: sticky;
        left: 0;
        top: 0;
        z-index: 25;
        background: #f8fafc;
        border-right: 2px solid #e5e7eb;
    }

    .supplier-table th:nth-child(2) { width: 35px; }   /* 순번 */
    .supplier-table th:nth-child(3) { width: 54px; }   /* 점수 */
    .supplier-table th:nth-child(4) { width: 100px; }  /* 공급사ID */
    .supplier-table th:nth-child(5) { width: 80px; }   /* 닉네임 */
    .supplier-table th:nth-child(6) { width: 70px; }   /* 평균단가 */
    .supplier-table th:nth-child(7) { width: 50px; }   /* 상품수 */
    .supplier-table th:nth-child(8) { width: 50px; }   /* 출고속도 */
    .supplier-table th:nth-child(9) { width: 60px; }   /* 묶음배송 */
    .supplier-table th:nth-child(10) { width: 70px; }  /* 평균배송비 */
    .supplier-table th:nth-child(11) { width: 40px; }  /* 등급 */
    .supplier-table th:nth-child(12) { width: 80px; }  /* 사업자명 */
    .supplier-table th:nth-child(13) { width: 200px; } /* 사업장주소/반품주소 */
    .supplier-table th:nth-child(14) { width: 90px; }  /* 연락처 */
    .supplier-table th:nth-child(15) { width: 100px; } /* API업데이트 */
    
    /* 아이콘 크기 조정 */
    .supplier-icon {
        min-width: 1.2rem;
        height: 1.2rem;
        font-size: 0.8rem;
    }
    
    .group-icon {
        font-size: 0.9rem;
    }
    
    /* 모달 모바일 최적화 */
    .group-modal-content {
        margin: 1rem;
        padding: 1.2rem;
        max-height: 85vh;
        overflow-y: auto;
        font-size: 0.8rem;
    }

    .group-modal h3 {
        font-size: 1.1rem;
    }

    .group-modal-field label {
        font-size: 0.75rem;
    }

    .group-modal-buttons button {
        font-size: 0.8rem;
        padding: 0.6rem 1.2rem;
    }

    /* 미리보기 카드 모바일 */
    .preview-card {
        padding: 0.75rem;
    }

    .preview-card-info {
        grid-template-columns: repeat(2, 1fr);
        font-size: 0.7rem;
    }

    .preview-card-addr {
        font-size: 0.7rem;
    }

    .scan-cluster {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }

    /* 모바일 체크박스 컬럼 고정 */
    .supplier-table td:nth-child(1) {
        position: sticky;
        left: 0;
        z-index: 15;
        background: white;
        border-right: 2px solid #f3f4f6;
    }

}

/* ── 소싱 모달 헤더 평가 영역 ── */
.sourcing-header {
    flex-wrap: wrap;
    gap: 0.4rem;
}

.sourcing-header .modal-close {
    margin-left: 0.5rem;
    font-size: 28px;
    width: 34px;
    height: 34px;
}

.sourcing-header h3 {
    margin: 0;
    font-size: var(--font-base);
    white-space: nowrap;
    flex-shrink: 0;
}

/* 평가 인라인 그룹 (헤더 내) */
.sourcing-eval-inline {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

/* 평가 상태 색상 점 */
.sourcing-rating-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-300);
    flex-shrink: 0;
    transition: background 0.2s;
}

.sourcing-rating-dot[data-rating="like"]      { background: var(--success-color); }
.sourcing-rating-dot[data-rating="normal"]    { background: var(--warning-color); }
.sourcing-rating-dot[data-rating="dislike"]   { background: #f97316; }
.sourcing-rating-dot[data-rating="blacklist"] { background: #ef4444; }

/* 평가 버튼 (헤더 인라인) */
.eval-rating-btn {
    padding: 0.15rem 0.35rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s;
    line-height: 1;
}

.eval-rating-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.eval-rating-btn.active {
    background: #f0f4ff;
    border-color: var(--primary-color);
}

/* 평가이유 토글 버튼 */
.eval-reason-toggle {
    padding: 0.15rem 0.35rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
    line-height: 1;
    opacity: 0.6;
}

.eval-reason-toggle:hover,
.eval-reason-toggle.active {
    opacity: 1;
    background: var(--gray-100);
    border-color: var(--gray-300);
}

/* 평가이유 패널 (헤더 아래 슬라이드) */
.eval-reason-panel {
    padding: 0.4rem 1rem;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}

.eval-reason-input {
    width: 100%;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    font-family: inherit;
    box-sizing: border-box;
}

.eval-reason-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 자동저장 상태 */
.eval-save-status {
    font-size: var(--font-xs);
    color: var(--gray-400);
    white-space: nowrap;
    flex-shrink: 0;
}

.eval-save-status.saving { color: var(--warning-color); }
.eval-save-status.saved  { color: var(--success-color); }

/* 가공상태 버튼 그룹 (결과행) */
.eval-process-group {
    display: flex;
    gap: 0.25rem;
}

.eval-process-btn {
    padding: 0.15rem 0.45rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    cursor: pointer;
    font-size: var(--font-xs);
    transition: all 0.15s;
    white-space: nowrap;
    height: var(--row-height, 24px);
    box-sizing: border-box;
    line-height: 1;
}

.eval-process-btn:hover:not(.active) {
    border-color: var(--gray-400);
    background: var(--gray-100);
}

.eval-process-btn.active[data-status="unprocessed"] {
    border-color: var(--gray-500);
    background: var(--gray-100);
    color: var(--gray-500);
    font-weight: 600;
}

.eval-process-btn.active[data-status="progress"] {
    border-color: var(--warning-color);
    background: #fffbeb;
    color: #d97706;
    font-weight: 600;
}

.eval-process-btn.active[data-status="completed"] {
    border-color: var(--success-color);
    background: #f0fdf4;
    color: var(--success-color);
    font-weight: 600;
}

/* 현재 사업자 표시 (결과행) */
.sourcing-biz-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-300);
    flex-shrink: 0;
    transition: background 0.2s;
}

.sourcing-biz-dot[data-status="completed"] { background: var(--success-color); }
.sourcing-biz-dot[data-status="progress"]  { background: var(--warning-color); }
.sourcing-biz-dot[data-status="unprocessed"] { background: var(--gray-400); }

.sourcing-current-biz {
    font-size: var(--font-xs);
    color: var(--gray-500);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: var(--row-height, 24px);
}

.sourcing-stats-inline {
    position: relative;
    font-size: var(--font-xs);
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    padding: 0.1rem 0.3rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    user-select: none;
    line-height: 1;
    height: var(--row-height, 24px);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.sourcing-stats-inline:hover {
    background: var(--gray-100);
}

.sourcing-stats-inline strong {
    color: var(--primary-color);
    font-weight: 700;
}

.sourcing-stats-inline.all-selected strong {
    color: var(--success-color);
}

/* ── 소싱이력 서브모달 ── */
.modal-content.modal-sourcing-history {
    width: 700px;
    max-width: 700px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.sourcing-history-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem;
}

.sourcing-history-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.25rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: var(--font-sm);
    white-space: nowrap;
}

.sourcing-history-row:last-child {
    border-bottom: none;
}

.sh-date  { color: var(--gray-500); font-size: var(--font-xs); min-width: 102px; flex-shrink: 0; display: flex; align-items: center; }
.sh-tag-icon { font-size: 13px; flex-shrink: 0; margin-right: -2px; }
.sh-biz   { color: var(--gray-700); font-weight: 500; flex-shrink: 0; }
.sh-price { color: var(--gray-700); min-width: 90px; flex-shrink: 0; }
.sh-count { color: var(--primary-color); font-weight: 600; margin-left: auto; flex-shrink: 0; }

.sh-tag-btn {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    color: var(--gray-600);
    font-size: 11px;
    font-family: monospace;
    padding: 1px 5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    line-height: 1.5;
}
.sh-tag-btn:hover {
    background: var(--primary-light, #e8f0fe);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 가격 라인 최근 태그 */
.sourcing-last-tag-wrap {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
    flex-shrink: 0;
}
.sourcing-last-tag-label {
    font-size: 13px;
    line-height: 1;
}
.sourcing-last-tag-btn {
    background: var(--primary-light, #e8f0fe);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    color: var(--primary-color);
    font-size: 11px;
    font-family: monospace;
    font-weight: 600;
    padding: 2px 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    line-height: 1.5;
}
.sourcing-last-tag-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

.sh-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    font-size: 1rem;
    padding: 0 0.2rem;
    line-height: 1;
    transition: color 0.15s;
}

.sh-delete-btn:hover { color: var(--error-color); }

.sourcing-history-footer {
    display: flex;
    justify-content: flex-end;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--gray-200);
}

.sourcing-history-loading,
.sourcing-history-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: var(--font-sm);
}
/* 동기화 프로그레스 오버레이 */
.sync-progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.sync-progress-box {
    background: #fff;
    border-radius: 12px;
    padding: 2rem 2.5rem;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.sync-progress-title {
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.sync-progress-bar-wrap {
    width: 100%;
    height: 10px;
    background: var(--gray-200);
    border-radius: 99px;
    overflow: hidden;
}

.sync-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--primary-color);
    border-radius: 99px;
    transition: width 0.3s ease;
}

.sync-progress-text {
    text-align: center;
    font-size: var(--font-sm);
    color: var(--text-muted);
}

.sync-stop-btn {
    align-self: center;
    padding: 0.4rem 1.5rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: var(--font-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
}

.sync-stop-btn:hover {
    background: var(--error-color);
    color: #fff;
    border-color: var(--error-color);
}

/* ===== 신뢰/기회 점수 배지 ===== */
.score-cell {
    text-align: center;
    cursor: default;
    white-space: nowrap;
    padding: 2px 4px !important;
}

.score-badge {
    display: inline-block;
    min-width: 28px;
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    line-height: 1.4;
    margin: 1px 0;
}

.score-cell .score-badge:first-child {
    display: block;
    margin-bottom: 2px;
}

.score-cell .score-badge:last-child {
    display: block;
}

/* 점수 등급 색상 (3색 노션 스타일) */
.score-positive {
    background: #e8f5e9;
    color: #2e7d32;
}

.score-neutral {
    background: #f0f0f0;
    color: #616161;
}

.score-negative {
    background: #fce8e8;
    color: #c62828;
}

/* 점수 셀 클릭 커서 */
.score-cell {
    cursor: pointer;
}

/* ===== 점수 팝오버 ===== */
.score-popover-wrap {
    position: fixed;
    z-index: 2100;
    animation: sp-fade-in 0.15s ease-out;
}

@keyframes sp-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.score-popover {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    width: 480px;
    overflow: hidden;
}

.sp-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.sp-supplier-id {
    margin-left: auto;
    font-size: 12px;
    color: #9ca3af;
    font-family: monospace;
}

.sp-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sp-title .score-badge {
    font-size: 15px;
    padding: 3px 10px;
    min-width: 52px;
}

.sp-title-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.sp-body {
    display: flex;
    gap: 0;
}

.sp-col {
    flex: 1;
    padding: 12px 14px;
}

.sp-col:first-child {
    border-right: 1px solid #f3f4f6;
}

.sp-col-header {
    font-size: 12.5px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f3f4f6;
}

.sp-row {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 0;
    font-size: 12.5px;
    line-height: 1.6;
}

.sp-row-active {
    color: #1f2937;
}

.sp-row-muted {
    color: #9ca3af;
}

.sp-icon {
    flex-shrink: 0;
    width: 18px;
    font-size: 12px;
    text-align: center;
}

.sp-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-pts {
    flex-shrink: 0;
    font-weight: 600;
    min-width: 30px;
    text-align: right;
    font-size: 12px;
}

.sp-row-active .sp-pts {
    color: #059669;
}

.sp-row-muted .sp-pts {
    color: #d1d5db;
}

.sp-comment {
    padding: 10px 16px;
    font-size: 13px;
    color: #4b5563;
    background: #f0fdf4;
    border-top: 1px solid #e5e7eb;
    line-height: 1.6;
}

/* V5 신뢰점수 팝오버 추가 스타일 */
.sp-section-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 8px 0 4px;
    padding-bottom: 3px;
    border-bottom: 1px dashed #e5e7eb;
}
.sp-section-label:first-of-type {
    margin-top: 0;
}
.sp-section-sub {
    color: #9ca3af;
}

/* 기본점수 행 */
.sp-row-base {
    background: #eff6ff;
    border-radius: 4px;
    padding: 4px 6px;
    margin: 2px -6px;
    font-weight: 600;
}
.sp-pts-base {
    color: #1d4ed8;
    font-size: 13px;
}

/* 보조합계 행 */
.sp-row-sub-total {
    background: #f0fdf4;
    border-radius: 4px;
    padding: 4px 6px;
    margin: 2px -6px;
    font-size: 11.5px;
}
.sp-row-sub-total .sp-pts {
    color: #059669;
    font-size: 11.5px;
}

/* 정보 행 (시설/매칭 표시) */
.sp-row-info {
    color: #374151;
}

/* 태그형 pts */
.sp-pts-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}
.sp-pts-tag-yes {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}
.sp-pts-tag-no {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.sp-pts-max {
    font-size: 10px;
    font-weight: 400;
    color: #9ca3af;
    margin-left: 1px;
}
