:root {
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --primary-light: #EEF2FF;
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --info: #3B82F6;
  --info-light: #DBEAFE;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --sidebar-width: 240px;
  --header-height: 60px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
}

/* 앱 컨테이너 */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* 사이드바 */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--gray-900) 0%, var(--gray-800) 100%);
  color: white;
  position: fixed;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.logo {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo i {
  font-size: 1.5rem;
  color: var(--primary);
}

.nav-menu {
  flex: 1;
  padding: 20px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  color: var(--gray-300);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: white;
}

.nav-item.active {
  background: rgba(79, 70, 229, 0.2);
  color: white;
  border-left-color: var(--primary);
}

.nav-item i {
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 20px;
  text-align: center;
  color: var(--gray-500);
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* 메인 콘텐츠 */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px;
}

/* 페이지 */
.page {
  display: none;
}

.page.active {
  display: block;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header h1 i {
  color: var(--primary);
}

.page-desc {
  margin: -16px 0 20px;
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.5;
}

.page-help-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 50%;
  font-size: 1rem;
  color: #94a3b8;
  cursor: pointer;
  margin-left: 8px;
  transition: all 0.2s;
  vertical-align: middle;
}

.page-help-toggle:hover {
  background: #eef2ff;
  color: var(--primary);
}

/* 상품 관리(신규) */
.pv2-badge { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; }
.pv2-badge-single { background:#e0f2fe; color:#0369a1; }
.pv2-badge-set { background:#fef3c7; color:#b45309; }
.pv2-badge-draft { background:#fee2e2; color:#b91c1c; }
.pv2-chip { display:inline-block; padding:1px 6px; margin:1px; border-radius:6px; background:#f1f5f9; color:#475569; font-size:11px; font-family:monospace; }
.pv2-type-toggle { display:flex; gap:8px; }
.pv2-type-btn { flex:1; padding:10px; border:2px solid #e2e8f0; background:#fff; border-radius:8px; cursor:pointer; font-size:14px; color:#64748b; transition:all 0.15s; }
.pv2-type-btn.active { border-color:var(--primary); background:#eef2ff; color:var(--primary); font-weight:600; }
.pv2-sku-opt:hover { background:#f8fafc; }

/* 상품 관리(신규) — 표/모달 폭 정리 (가로 스크롤 방지) */
#pv2-table { table-layout: fixed; }
#pv2-table th, #pv2-table td { white-space: normal; word-break: break-word; overflow-wrap: anywhere; vertical-align: middle; padding: 10px 12px; }
#pv2-table td:nth-child(3), #pv2-table td:nth-child(5) { text-align: left; }
#pv2-table th:nth-child(1), #pv2-table td:nth-child(1) { width: 76px; }
#pv2-table th:nth-child(2), #pv2-table td:nth-child(2) { width: 70px; }
#pv2-table th:nth-child(4), #pv2-table td:nth-child(4) { width: 116px; }
#pv2-table th:nth-child(5), #pv2-table td:nth-child(5) { width: 26%; }
#pv2-table th:nth-child(6), #pv2-table td:nth-child(6) { width: 72px; }
#pv2-table th:nth-child(7), #pv2-table td:nth-child(7) { width: 96px; }
#pv2-table .pv2-chip { white-space: nowrap; }

#pv2-modal .modal-body, #pv2-mapping-modal .modal-body { overflow-x: hidden; }
#pv2-modal .data-table { table-layout: fixed; width: 100%; }
#pv2-modal .data-table th, #pv2-modal .data-table td { white-space: normal; word-break: break-word; overflow-wrap: anywhere; text-align: left; padding: 8px 10px; }
#pv2-modal .data-table .pv2-c-cat { width: 18%; }
#pv2-modal .data-table .pv2-c-code { width: 20%; }
#pv2-modal .data-table .pv2-c-qty { width: 58px; padding-left: 6px; padding-right: 6px; }
#pv2-modal .data-table .pv2-c-ratio { width: 66px; padding-left: 6px; padding-right: 6px; }
#pv2-modal .data-table .pv2-c-del { width: 52px; padding-left: 4px; padding-right: 4px; }
#pv2-modal .data-table input[type="number"] { width: 100%; box-sizing: border-box; padding: 4px 5px; -moz-appearance: textfield; appearance: textfield; }
#pv2-modal .data-table input[type="number"]::-webkit-inner-spin-button,
#pv2-modal .data-table input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#pv2-mapping-candidates > div > span:first-child, #pv2-mapping-list > div > span:first-child { min-width: 0; word-break: break-word; overflow-wrap: anywhere; }
#pv2-mapping-candidates > div > button, #pv2-mapping-list > div > button { flex-shrink: 0; }

/* 사용법 모달 */
.help-modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}

.help-modal-overlay.active {
  display: flex;
}

.help-modal {
  background: #fff;
  border-radius: 16px;
  width: 520px;
  max-width: 92vw;
  max-height: 80vh;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  animation: helpModalIn 0.25s ease;
}

@keyframes helpModalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.help-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e2e8f0;
}

.help-modal-header h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.help-modal-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
}

.help-modal-close {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  color: #94a3b8;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.help-modal-close:hover {
  background: #f1f5f9;
  color: #475569;
}

.help-modal-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  flex: 1;
}

.help-modal-section {
  margin-bottom: 20px;
}

.help-modal-section:last-child {
  margin-bottom: 0;
}

.help-modal-section h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-modal-section h4::before {
  content: '';
  width: 4px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
}

.help-modal-section ul,
.help-modal-section ol {
  margin: 0;
  padding-left: 20px;
  font-size: 0.8125rem;
  color: #475569;
  line-height: 1.9;
}

.help-modal-section li {
  margin-bottom: 3px;
}

.help-modal-tip {
  background: linear-gradient(135deg, #eef2ff, #f0f4ff);
  border-left: 3px solid var(--primary);
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
  font-size: 0.8125rem;
  color: #4338ca;
  line-height: 1.6;
  margin-top: 16px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* 통계 카드 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-card.primary .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-card.success .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-card.info .stat-icon { background: var(--info-light); color: var(--info); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* 콤팩트 통계 카드 (신규 메뉴용) */
.stat-card.compact {
  padding: 10px 14px;
  border-radius: 8px;
  gap: 4px;
  flex-direction: column;
  align-items: flex-start;
  min-width: 110px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  border: 1px solid var(--gray-200, #e5e7eb);
}
.stat-card.compact:hover {
  transform: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.stat-card.compact .stat-label {
  font-size: 11px;
  color: var(--gray-500, #6b7280);
  white-space: nowrap;
}
.stat-card.compact .stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}
.stats-row-compact {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

/* v2 페이지: 페이지 스크롤 없이 테이블만 스크롤 */
.page.v2-layout.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
  overflow: hidden;
}
.page.v2-layout .page-header {
  flex: 0 0 auto;
  margin-bottom: 10px;
}
.page.v2-layout .page-header h1 {
  font-size: 1.25rem;
  margin: 0 0 4px;
}
.page.v2-layout .page-header .page-desc {
  font-size: 12px;
  margin: 0;
  color: var(--gray-500, #6b7280);
}
.page.v2-layout .filter-bar {
  flex: 0 0 auto;
  padding: 8px 12px;
  gap: 8px;
  margin-bottom: 8px;
}
.page.v2-layout .filter-bar label {
  font-size: 11px;
}
.page.v2-layout .filter-bar select,
.page.v2-layout .filter-bar input[type="date"],
.page.v2-layout .filter-bar input[type="text"] {
  font-size: 12px;
  padding: 4px 8px;
  height: 30px;
}
.page.v2-layout .stats-row-compact {
  flex: 0 0 auto;
}
.v2-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--gray-200, #e5e7eb);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.v2-table-wrap table.data-table {
  border-collapse: separate;
  border-spacing: 0;
}
.v2-table-wrap .data-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f3f4f6;
  font-size: 11px;
  padding: 8px 10px;
  border-bottom: 1px solid #d1d5db;
}
.v2-table-wrap .data-table td {
  padding: 5px 10px;
  font-size: 12px;
  white-space: nowrap;
}
.v2-table-wrap .data-table tbody tr:nth-child(even) {
  background: #fafafa;
}
/* 판매내역(신규) 표 — 줄바꿈 방지(강화) + 긴 컬럼(제품군/대표명/옵션명) 폭 제한·말줄임 */
#salesv2-table th, #salesv2-table td { white-space: nowrap; }
#salesv2-table td:nth-child(4) { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
#salesv2-table td:nth-child(5),
#salesv2-table td:nth-child(8) { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.v2-pagination {
  flex: 0 0 auto;
  padding: 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.text-right { text-align: right !important; }

.v2-tabs { flex: 0 0 auto; }
.v2-tab {
  background: #f3f4f6; color: #374151;
  border: 1px solid #d1d5db; border-radius: 6px;
  padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.v2-tab:hover { background: #e5e7eb; }
.v2-tab.active {
  background: #3b82f6; color: #fff; border-color: #3b82f6;
}

/* 차트 영역 */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.chart-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chart-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-700);
}

.chart-container {
  height: 250px;
}

.chart-bar {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.chart-bar-label {
  width: 100px;
  font-size: 0.875rem;
  color: var(--gray-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-bar-track {
  flex: 1;
  height: 24px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.chart-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--info) 100%);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.chart-bar-value {
  width: 60px;
  text-align: right;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  padding-left: 12px;
}

/* 필터 바 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  background: white;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}

.filter-group.search-group {
  flex: 1;
  min-width: 250px;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.875rem;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-input {
  position: relative;
}

.search-input input {
  width: 100%;
  padding-right: 40px;
}

.search-input i {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
}

/* 결과 정보 */
.result-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: var(--gray-600);
}

/* 테이블 */
.table-container {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  text-align: center;
  border: 1px solid #e5e7eb;
  white-space: nowrap;
}

.data-table th {
  background: var(--gray-50);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-600);
  text-align: center !important;
}

.data-table tbody tr:hover {
  background: var(--gray-50);
}

.data-table td {
  font-size: 0.875rem;
}

.checkbox-col {
  width: 40px;
  text-align: center !important;
}

.action-col {
  width: 100px;
  text-align: center !important;
}

/* SKU 테이블 - 내용에 맞게 자동 조절 */
#sku-table {
  width: 100%;
}

#sku-table th,
#sku-table td {
  white-space: nowrap;
  padding: 10px 12px;
}

/* 옵션명, 특이사항만 줄바꿈 허용 */
#sku-table td:nth-child(4),
#sku-table td:nth-child(7) {
  white-space: normal;
  word-break: break-word;
  max-width: 250px;
  text-align: left;
}

#sku-table td:nth-child(8) .btn {
  padding: 4px 8px;
  font-size: 12px;
  margin: 0 2px;
}

.action-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.action-btns button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btns .btn-edit {
  background: var(--info-light);
  color: var(--info);
}

.action-btns .btn-edit:hover {
  background: var(--info);
  color: white;
}

.action-btns .btn-delete {
  background: var(--danger-light);
  color: var(--danger);
}

.action-btns .btn-delete:hover {
  background: var(--danger);
  color: white;
}

/* 태그 뱃지 */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 20px;
}

.badge-channel {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-info {
  background: var(--info-light);
  color: var(--info);
}

/* 주문 확장 가능 행 */
.order-summary-row:hover {
  background: var(--gray-50) !important;
}
.order-summary-row td:first-child i {
  transition: transform 0.2s;
  color: var(--gray-400);
  font-size: 0.75rem;
}
.order-items-row td {
  border-top: none !important;
}
.order-items-row table th {
  position: sticky;
  top: 0;
}

.alert-info {
  background: var(--info-light);
  color: var(--info);
  border: 1px solid var(--info);
  padding: 12px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-set {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--gray-100);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  margin: 2px;
}

.badge-set .ratio {
  background: var(--primary);
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.625rem;
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-200);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
}

.btn-outline:hover:not(:disabled) {
  background: var(--gray-100);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

/* 모달 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.3s ease;
}

.modal-content.modal-lg {
  max-width: 700px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h2 i {
  color: var(--primary);
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--gray-100);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* 폼 */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
}

.form-group .required {
  color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

.form-row .form-group.flex-2 {
  flex: 2;
}

.form-row .form-group.flex-1 {
  flex: 1;
}

.section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin: 24px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 8px;
}

.set-composition .set-item {
  background: var(--gray-50);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
}

/* 토스트 */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--gray-900);
  color: white;
  padding: 14px 24px;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 2000;
  animation: toastIn 0.3s ease;
}

.toast.active {
  display: flex;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 로딩 */
.loader {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 10px;
}

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

.loading-row td {
  text-align: center;
  padding: 60px 40px;
  color: var(--gray-500);
  font-size: 0.9rem;
}

.loading-row td .loader {
  width: 32px;
  height: 32px;
  border-width: 4px;
  margin-bottom: 12px;
  margin-right: 0;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-content .loader {
  width: 40px;
  height: 40px;
  border-width: 4px;
  margin: 0;
}

.loading-content span {
  color: var(--gray-500);
  font-size: 0.875rem;
}

.loading-text {
  color: var(--gray-400);
  font-size: 0.875rem;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 설정 페이지 */
.settings-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--gray-200);
  padding-bottom: 0;
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: var(--gray-500);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.settings-tab:hover {
  color: var(--primary);
}

.settings-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.settings-tab i {
  font-size: 1rem;
}

.settings-tab-content {
  display: none;
}

.settings-tab-content.active {
  display: block;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
}

.settings-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  overflow: hidden;
}

.settings-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
}

.settings-card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-700);
}

.settings-card-header h3 i {
  color: var(--primary);
}

.settings-card-body {
  padding: 0;
}

.data-table.compact th,
.data-table.compact td {
  padding: 10px 14px;
  font-size: 0.8125rem;
  text-align: center;
  border: 1px solid #e5e7eb;
}

.modal-content.modal-sm {
  max-width: 400px;
}

.settings-card.full-width {
  grid-column: 1 / -1;
}

.settings-hint {
  padding: 12px 16px;
  background: var(--info-light);
  border-radius: 8px;
  font-size: 0.8125rem;
  color: var(--gray-600);
  margin: 0;
  border-bottom: 1px solid var(--gray-100);
}

.settings-hint i {
  color: var(--info);
  margin-right: 6px;
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--gray-600);
  margin-bottom: 12px;
}

.form-hint i {
  color: var(--primary);
  margin-right: 6px;
}

.form-group small {
  display: block;
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 4px;
}

/* 판매내역 페이지 */
.sales-stats {
  margin-bottom: 20px;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-range input {
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.875rem;
}

.date-range span {
  color: var(--gray-400);
}

/* 통계/분석 페이지 */
.stats-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.chart-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
}

.chart-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-header h3 i {
  color: var(--primary);
}

.chart-body {
  padding: 20px;
  height: 300px;
}

.stats-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
}

.stats-table-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  overflow: hidden !important;
}

.stats-table-card * {
  overflow-x: hidden !important;
}

.stats-table-card .data-table.compact {
  table-layout: fixed !important;
  width: 100% !important;
}

.stats-table-card .data-table.compact th,
.stats-table-card .data-table.compact td {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.stats-table-card.full-width {
  grid-column: 1 / -1;
}

.stats-table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
}

.stats-table-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-table-header h3 i {
  color: var(--primary);
}

.stats-table-body {
  max-height: 350px;
  overflow-y: auto;
  overflow-x: hidden !important;
}

.stats-table-body table {
  margin: 0;
}

.percent-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.percent-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
}

.percent-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--info) 100%);
  border-radius: 4px;
  transition: width 0.3s;
}

.percent-bar span {
  font-size: 0.75rem;
  color: var(--gray-600);
  min-width: 45px;
  text-align: right;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
}

.rank-badge.gold {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: white;
}

.rank-badge.silver {
  background: linear-gradient(135deg, #C0C0C0 0%, #A0A0A0 100%);
  color: white;
}

.rank-badge.bronze {
  background: linear-gradient(135deg, #CD7F32 0%, #8B4513 100%);
  color: white;
}

.rank-badge.normal {
  background: var(--gray-200);
  color: var(--gray-600);
}

/* 업로드 영역 */
.upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  transform: scale(1.02);
}

.upload-zone.drag-over i {
  color: var(--primary);
  transform: scale(1.2);
}

.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--gray-50);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-content i {
  font-size: 3rem;
  color: var(--gray-400);
  margin-bottom: 16px;
}

.upload-zone:hover .upload-content i {
  color: var(--primary);
}

.upload-content p {
  font-size: 1rem;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.upload-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.upload-file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--success-light);
  border-radius: 8px;
  margin-top: 16px;
}

.upload-file-info i {
  font-size: 1.5rem;
  color: var(--success);
}

.upload-file-info span {
  flex: 1;
  font-size: 0.875rem;
  color: var(--gray-700);
}

.btn-icon {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--gray-500);
  border-radius: 50%;
}

.btn-icon:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.upload-progress {
  margin-top: 20px;
}

.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--info) 100%);
  width: 0%;
  transition: width 0.3s;
  animation: progressPulse 1.5s infinite;
}

@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.upload-progress span {
  display: block;
  text-align: center;
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--gray-600);
}

.upload-result {
  margin-top: 20px;
  padding: 16px;
  border-radius: 8px;
  background: var(--gray-50);
}

.upload-result.success {
  background: var(--success-light);
}

.upload-result.error {
  background: var(--danger-light);
}

.upload-result h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-result ul {
  list-style: none;
  font-size: 0.8125rem;
  color: var(--gray-600);
}

.upload-result li {
  padding: 4px 0;
}

/* 반응형 */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }

  .sidebar .logo span,
  .sidebar .nav-item span,
  .sidebar-footer {
    display: none;
  }

  .logo {
    justify-content: center;
    padding: 20px 0;
  }

  .nav-item {
    justify-content: center;
    padding: 14px 0;
  }

  .main-content {
    margin-left: 60px;
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .filter-bar {
    flex-direction: column;
  }

  .filter-group {
    width: 100%;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    margin: 16px;
  }
}

/* 판매 추이 섹션 */
.sales-trend-section {
  margin-bottom: 24px;
}

.trend-summary {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
}

.trend-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trend-label {
  font-size: 12px;
  color: #64748b;
}

.trend-value {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
}

.trend-bar-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trend-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trend-bar-label {
  width: 70px;
  font-size: 12px;
  color: #64748b;
  text-align: right;
}

.trend-bar-bg {
  flex: 1;
  height: 24px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.trend-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  min-width: 60px;
}

.trend-bar-value {
  font-size: 11px;
  color: white;
  font-weight: 500;
}

@media (max-width: 768px) {
  .trend-summary {
    flex-direction: column;
    gap: 12px;
  }
}

/* 판매 요약 바 */
.sales-summary-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 12px;
  color: white;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.summary-item i {
  font-size: 20px;
  opacity: 0.8;
}

.summary-info {
  display: flex;
  flex-direction: column;
}

.summary-label {
  font-size: 11px;
  opacity: 0.8;
}

.summary-value {
  font-size: 16px;
  font-weight: 700;
}

/* 2열 그리드 */
.dashboard-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .dashboard-grid-2 {
    grid-template-columns: 1fr;
  }
  .sales-summary-bar {
    flex-wrap: wrap;
  }
  .summary-item {
    min-width: 45%;
  }
}

/* 상세 카드 */
.detail-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.detail-card h4 {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
}

.detail-card h4 i {
  color: #3b82f6;
}

.detail-table-wrap {
  max-height: 280px;
  overflow-y: auto;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.detail-table th {
  text-align: center !important;
  padding: 8px 6px;
  font-weight: 600;
  color: #6b7280;
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  background: white;
}

.detail-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
  text-align: center;
}

.detail-table tr:hover {
  background: #f9fafb;
}

.detail-table .text-right {
  text-align: right;
}

.detail-table .rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #f3f4f6;
  color: #6b7280;
}

.detail-table .rank-badge.gold { background: #fbbf24; color: white; }
.detail-table .rank-badge.silver { background: #9ca3af; color: white; }
.detail-table .rank-badge.bronze { background: #d97706; color: white; }

.detail-table .change-up { color: #10b981; }
.detail-table .change-down { color: #ef4444; }
.detail-table .change-same { color: #6b7280; }

.detail-table .product-name {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 매칭 탭 */
.matching-tab-content {
  display: none;
}

.matching-tab-content.active {
  display: block;
}

/* 반응형 숨김 클래스 */
@media (max-width: 1200px) {
  .hide-tablet {
    display: none !important;
  }

  .stats-tables {
    grid-template-columns: 1fr;
  }

  .stats-table-card {
    overflow: hidden !important;
  }

  .stats-table-body {
    overflow-x: hidden !important;
  }

  .stats-table-card .data-table.compact {
    table-layout: fixed !important;
    width: 100% !important;
  }

  .stats-table-card .data-table.compact th,
  .stats-table-card .data-table.compact td {
    padding: 8px 4px !important;
    font-size: 11px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .stats-table-card .data-table.compact th:first-child,
  .stats-table-card .data-table.compact td:first-child {
    width: 22% !important;
    max-width: 90px !important;
  }

  .stats-table-card .data-table.compact th:nth-child(2),
  .stats-table-card .data-table.compact td:nth-child(2) {
    width: 12% !important;
  }

  .stats-table-card .data-table.compact th:nth-child(3),
  .stats-table-card .data-table.compact td:nth-child(3) {
    width: 22% !important;
  }

  .stats-table-card .data-table.compact th:nth-child(4),
  .stats-table-card .data-table.compact td:nth-child(4) {
    width: 22% !important;
  }

  .stats-table-card .data-table.compact th:nth-child(5),
  .stats-table-card .data-table.compact td:nth-child(5) {
    width: 12% !important;
  }

  .stats-table-card .data-table.compact th:last-child,
  .stats-table-card .data-table.compact td:last-child {
    width: 50px !important;
    min-width: 50px !important;
  }
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .date-range {
    width: 100%;
  }

  .date-range input[type="date"] {
    flex: 1;
    min-width: 0;
  }

  .stats-table-card .data-table.compact th,
  .stats-table-card .data-table.compact td {
    padding: 6px 3px;
    font-size: 10px;
  }

  .stats-table-card {
    overflow: hidden;
  }

  .stats-table-body {
    overflow-x: hidden !important;
    overflow-y: auto;
  }

  .stats-table-card .data-table.compact {
    table-layout: fixed;
    width: 100%;
  }

  .stats-table-card .data-table.compact th:first-child,
  .stats-table-card .data-table.compact td:first-child {
    width: 28%;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .stats-table-card .data-table.compact th:nth-child(2),
  .stats-table-card .data-table.compact td:nth-child(2) {
    width: 18%;
    text-align: right;
  }

  .stats-table-card .data-table.compact th:last-child,
  .stats-table-card .data-table.compact td:last-child {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
  }

  .stats-table-card .data-table.compact .btn {
    padding: 4px 6px;
    font-size: 9px;
  }

  .stats-table-card .data-table.compact .btn i {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stats-table-header h3 {
    font-size: 13px;
  }

  .stats-table-header h3 i {
    display: none;
  }

  .stats-table-card .data-table.compact th,
  .stats-table-card .data-table.compact td {
    padding: 5px 2px;
    font-size: 9px;
  }

  .stats-table-card .data-table.compact th:first-child,
  .stats-table-card .data-table.compact td:first-child {
    width: 30%;
    max-width: 70px;
  }
}

/* 상태 뱃지 */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 20px;
}

.status-badge.match {
  background: var(--success-light);
  color: var(--success);
}

.status-badge.mismatch-plus {
  background: var(--warning-light);
  color: var(--warning);
}

.status-badge.mismatch-minus {
  background: var(--danger-light);
  color: var(--danger);
}

.diff-positive {
  color: var(--success);
  font-weight: 600;
}

.diff-negative {
  color: var(--danger);
  font-weight: 600;
}

.diff-zero {
  color: var(--gray-500);
}

.stat-card.danger .stat-icon {
  background: var(--danger-light);
  color: var(--danger);
}

/* 통계 테이블 가로스크롤 완전 제거 - 모든 해상도 */
.stats-table-card {
  overflow: hidden !important;
}

.stats-table-body {
  overflow-x: hidden !important;
  overflow-y: auto;
}

.stats-table-card .data-table.compact {
  table-layout: fixed !important;
  width: 100% !important;
}

.stats-table-card .data-table.compact th,
.stats-table-card .data-table.compact td {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  text-align: center;
  padding: 10px 4px !important;
  font-size: 12px !important;
}

.stats-table-card .data-table.compact th:first-child,
.stats-table-card .data-table.compact td:first-child {
  width: 25% !important;
  text-align: left !important;
  padding-left: 12px !important;
}

.stats-table-card .data-table.compact th:nth-child(2),
.stats-table-card .data-table.compact td:nth-child(2) {
  width: 12% !important;
}

.stats-table-card .data-table.compact th:nth-child(3),
.stats-table-card .data-table.compact td:nth-child(3) {
  width: 22% !important;
}

.stats-table-card .data-table.compact th:nth-child(4),
.stats-table-card .data-table.compact td:nth-child(4) {
  width: 22% !important;
}

.stats-table-card .data-table.compact th:nth-child(5),
.stats-table-card .data-table.compact td:nth-child(5) {
  width: 10% !important;
}

.stats-table-card .data-table.compact th:last-child,
.stats-table-card .data-table.compact td:last-child {
  width: 9% !important;
}

@media (max-width: 1600px) {
  .stats-table-card .data-table.compact th,
  .stats-table-card .data-table.compact td {
    padding: 8px 3px !important;
    font-size: 11px !important;
  }
}

@media (max-width: 1400px) {
  .stats-table-card .data-table.compact th,
  .stats-table-card .data-table.compact td {
    padding: 7px 2px !important;
    font-size: 10px !important;
  }

  .stats-table-card .data-table.compact th:first-child,
  .stats-table-card .data-table.compact td:first-child {
    padding-left: 8px !important;
  }
}

@media (max-width: 1200px) {
  .stats-tables {
    grid-template-columns: 1fr !important;
  }

  .stats-table-card .data-table.compact th,
  .stats-table-card .data-table.compact td {
    padding: 8px 4px !important;
    font-size: 12px !important;
  }

  .stats-table-card .data-table.compact th:first-child,
  .stats-table-card .data-table.compact td:first-child {
    width: 22% !important;
  }

  .stats-table-card .data-table.compact .btn {
    padding: 4px 8px !important;
    font-size: 10px !important;
  }
}

@media (max-width: 768px) {
  .stats-table-card .data-table.compact th,
  .stats-table-card .data-table.compact td {
    padding: 6px 2px !important;
    font-size: 10px !important;
  }
}

/* ===== 자사몰 매핑 테이블 ===== */
#page-mall-mapping .data-table.compact {
  table-layout: fixed;
  width: 100%;
}

#page-mall-mapping .data-table.compact th,
#page-mall-mapping .data-table.compact td {
  padding: 8px 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#page-mall-mapping .table-container {
  overflow-x: hidden;
}

#page-mall-mapping .text-right {
  text-align: right;
}

#page-mall-mapping .text-danger {
  color: var(--danger);
}

/* ===== 리포트 헤더 ===== */
.report-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
  color: white;
  padding: 24px 28px;
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(30, 58, 95, 0.3);
}

.report-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.report-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.report-title h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.report-title .report-icon {
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.report-period {
  background: rgba(255,255,255,0.1);
  padding: 12px 16px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.report-period input[type="date"] {
  background: rgba(255,255,255,0.9);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #1e3a5f;
}

.report-period span {
  color: rgba(255,255,255,0.7);
}

.report-period .btn {
  background: #fff;
  color: #1e3a5f;
  font-weight: 600;
}

.report-period .btn:hover {
  background: #f0f0f0;
}

.report-period select {
  background: rgba(255,255,255,0.9);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #1e3a5f;
  cursor: pointer;
  min-width: 120px;
}

.report-period select:focus {
  outline: 2px solid rgba(255,255,255,0.5);
}

.report-period .period-divider {
  color: rgba(255,255,255,0.4);
  margin: 0 8px;
}

@media (max-width: 1200px) {
  .report-period {
    flex-wrap: wrap;
    gap: 8px;
  }

  .report-period .period-divider {
    display: none;
  }
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.report-summary-card {
  background: rgba(255,255,255,0.1);
  padding: 16px 20px;
  border-radius: 12px;
  text-align: center;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
}

.report-summary-card .label {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.report-summary-card .value {
  font-size: 1.5rem;
  font-weight: 700;
}

/* ===== 차트 섹션 ===== */
.charts-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card-new {
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  overflow: hidden;
}

.chart-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-card-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1e3a5f;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.chart-card-header h3 i {
  color: #4F46E5;
}

.chart-card-body {
  padding: 20px;
  height: 320px;
  position: relative;
}

.chart-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  gap: 12px;
}

.chart-loading .loader {
  width: 36px;
  height: 36px;
}

.chart-empty {
  color: #888;
  font-size: 0.875rem;
}

/* ===== 테이블 섹션 ===== */
.tables-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.table-card-new {
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  overflow: hidden;
}

.table-card-new.full-width {
  grid-column: 1 / -1;
}

.table-card-new.half-width {
  grid-column: span 2;
}

.table-card-header {
  padding: 14px 18px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-card-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e3a5f;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.table-card-header h3 i {
  color: #4F46E5;
  font-size: 0.9rem;
}

.table-card-header .badge-count {
  background: #4F46E5;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}

.table-card-body {
  max-height: 350px;
  overflow-y: auto;
}

/* 리포트 테이블 스타일 */
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.report-table th {
  background: #f8fafc;
  padding: 10px 12px;
  text-align: center !important;
  font-weight: 600;
  color: #64748b;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 1;
}

.report-table td {
  padding: 10px 12px;
  text-align: center;
  border: 1px solid #e5e7eb;
  color: #334155;
}

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

.report-table .text-right {
  text-align: right;
}

.report-table .text-center {
  text-align: center;
}

.report-table .name-cell {
  font-weight: 500;
  color: #1e293b;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-table .amount-cell {
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 0.8rem;
}

/* 비중 바 */
.ratio-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ratio-bar-bg {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  min-width: 50px;
}

.ratio-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.ratio-bar-fill.blue { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.ratio-bar-fill.green { background: linear-gradient(90deg, #10b981, #34d399); }
.ratio-bar-fill.orange { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.ratio-bar-fill.purple { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.ratio-bar span {
  font-size: 0.75rem;
  color: #64748b;
  min-width: 40px;
  text-align: right;
}

/* 순위 뱃지 */
.rank-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.rank-num.rank-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: white; }
.rank-num.rank-2 { background: linear-gradient(135deg, #94a3b8, #64748b); color: white; }
.rank-num.rank-3 { background: linear-gradient(135deg, #d97706, #b45309); color: white; }
.rank-num.rank-other { background: #f1f5f9; color: #64748b; }

/* 상세보기 버튼 */
.btn-detail {
  padding: 4px 10px;
  background: #f1f5f9;
  border: none;
  border-radius: 6px;
  color: #4F46E5;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-detail:hover {
  background: #4F46E5;
  color: white;
}

/* 다운로드 액션 바 */
.action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 20px;
}

.action-bar .btn {
  padding: 8px 16px;
  font-size: 0.8125rem;
}

/* ===== 리포트 반응형 ===== */
@media (max-width: 1400px) {
  .report-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-section {
    grid-template-columns: 1fr;
  }

  .tables-section {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-card-new.half-width {
    grid-column: span 1;
  }
}

@media (max-width: 1024px) {
  .tables-section {
    grid-template-columns: 1fr;
  }

  .table-card-new.half-width,
  .table-card-new.full-width {
    grid-column: span 1;
  }

  .report-header-top {
    flex-direction: column;
    gap: 16px;
  }

  .report-period {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .report-header {
    padding: 16px;
  }

  .report-summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .report-summary-card {
    padding: 12px;
  }

  .report-summary-card .value {
    font-size: 1.125rem;
  }

  .report-table th,
  .report-table td {
    padding: 8px 10px;
    font-size: 0.75rem;
  }

  .chart-card-body {
    height: 250px;
  }
}

/* ===== 판매내역 로딩 오버레이 ===== */
#page-sales .table-container {
  position: relative;
  min-height: 200px;
  overflow-x: auto;
}

.sales-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  gap: 16px;
  border-radius: 12px;
}

.sales-loading-overlay .loader {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

.sales-loading-overlay .loading-text {
  color: var(--gray-600);
  font-size: 0.9375rem;
  font-weight: 500;
}

.sales-loading-overlay .loading-subtext {
  color: var(--gray-400);
  font-size: 0.8125rem;
}

/* ===== 판매내역 테이블 ===== */
#sales-table {
  width: 100%;
  border-collapse: collapse;
}

#sales-table th,
#sales-table td {
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
  border: 1px solid var(--gray-200);
  padding: 10px 8px;
  font-size: 0.8125rem;
}

/* 헤더 스타일 */
#sales-table th {
  background: var(--gray-50);
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-300);
}

/* 행 호버 효과 */
#sales-table tbody tr:hover {
  background: var(--gray-50);
}

/* 상품명/옵션명만 말줄임 처리 (나머지는 전부 표시) */
#sales-table th:nth-child(6),
#sales-table td:nth-child(6),
#sales-table th:nth-child(7),
#sales-table td:nth-child(7) {
  text-align: left;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 상품군 */
#sales-table th:nth-child(11),
#sales-table td:nth-child(11) { text-align: center; }

/* ===== 커스텀 툴팁 ===== */
.custom-tooltip {
  position: fixed;
  z-index: 99999;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.8125rem;
  max-width: 400px;
  word-break: break-all;
  line-height: 1.6;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1) inset;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px) scale(0.95);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
}

.custom-tooltip.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.custom-tooltip::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 24px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #1e293b;
}

.custom-tooltip.tooltip-top::before {
  top: auto;
  bottom: -8px;
  border-bottom: none;
  border-top: 8px solid #334155;
}

.custom-tooltip .tooltip-label {
  font-size: 0.6875rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  font-weight: 600;
}

.custom-tooltip .tooltip-text {
  color: #f1f5f9;
  font-weight: 400;
}

/* 툴팁 대상 셀 */
.cell-truncate {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

/* ===== 버튼 로딩 스피너 ===== */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

.btn-secondary .btn-spinner,
.btn-outline .btn-spinner {
  border-color: rgba(0,0,0,0.2);
  border-top-color: var(--gray-600);
}

.btn-loading {
  pointer-events: none;
  opacity: 0.8;
}

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

/* 다중 선택 드롭다운 */
.multi-select-dropdown {
  position: relative;
  min-width: 160px;
}

.multi-select-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  min-height: 38px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.multi-select-display:hover {
  border-color: #3b82f6;
}

.multi-select-display.active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.multi-select-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #374151;
}

.multi-select-display i {
  margin-left: 8px;
  color: #6b7280;
  font-size: 12px;
  transition: transform 0.2s;
}

.multi-select-display.active i {
  transform: rotate(180deg);
}

.multi-select-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  z-index: 1000;
  max-height: 280px;
  overflow-y: auto;
}

.multi-select-option {
  padding: 8px 12px;
}

.multi-select-option label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
}

.multi-select-option label:hover {
  color: #1e40af;
}

.multi-select-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #3b82f6;
  cursor: pointer;
}

.multi-select-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 4px 0;
}

.multi-select-items {
  max-height: 200px;
  overflow-y: auto;
}

.multi-select-item {
  padding: 6px 12px;
}

.multi-select-item label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #4b5563;
}

.multi-select-item label:hover {
  color: #1e40af;
  background: #f8fafc;
}

.multi-select-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #3b82f6;
  cursor: pointer;
}

/* 누락된 버튼 스타일 */
.btn-warning {
  background: #f59e0b;
  color: white;
  border: none;
}
.btn-warning:hover {
  background: #d97706;
}

.btn-success {
  background: #10b981;
  color: white;
  border: none;
}
.btn-success:hover {
  background: #059669;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

/* 토스트 애니메이션 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(20px); }
}

/* SKU V2 모달 오버레이 */
.skuv2-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.skuv2-overlay.active {
  display: flex;
}

/* SKU V2 트리뷰 */
.skuv2-brand-group.collapsed .skuv2-brand-body,
.skuv2-cat-group.collapsed .skuv2-cat-body { display: none; }
.skuv2-brand-group.collapsed .skuv2-brand-header .skuv2-chevron,
.skuv2-cat-group.collapsed .skuv2-cat-header .skuv2-chevron { transform: rotate(-90deg); }
.skuv2-brand-header:hover { background: #e2e8f0 !important; }
.skuv2-cat-header:hover { background: #f1f5f9; }


/* ===== 테이블 화면 꽉 채움 레이아웃 ===== */

/* 공통: 해당 페이지들을 flex 컬럼으로 전환 */
#page-sku.active,
#page-sales.active,
#page-sku-new.active,
#page-product-new.active,
#page-set.active,
#page-settings.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
  overflow: hidden;
}

/* 직접 자식 table-container를 남은 공간 채움 */
#page-sku.active > .table-container,
#page-sales.active > .table-container,
#page-sku-new.active > .table-container,
#page-product-new.active > .table-container {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-radius: 12px;
}

/* SET 구성: 탭 콘텐츠가 남은 공간 채움 */
#page-set.active .matching-tab-content.active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#page-set.active .matching-tab-content.active > .table-container {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-radius: 12px;
}

/* 설정: 탭 콘텐츠 + 카드 + 카드바디 채움 */
#page-settings.active .settings-tabs { flex: 0 0 auto; }
#page-settings.active .settings-tab-content.active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#page-settings.active .settings-tab-content.active .settings-card.full-width {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#page-settings.active .settings-tab-content.active .settings-card-body {
  flex: 1 !important;
  min-height: 0;
  max-height: none !important;
  overflow-y: auto;
}

/* sticky 헤더 — fill-screen 모드 table-container 안 */
#page-sku.active > .table-container .data-table th,
#page-sales.active > .table-container .data-table th,
#page-sku-new.active > .table-container .data-table th,
#page-product-new.active > .table-container .data-table th,
#page-set.active .matching-tab-content.active > .table-container .data-table th,
#page-settings.active .settings-card-body .data-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--gray-50);
}

/* 판매내역 기존탭 pagination */
#page-sales.active #sales-pagination {
  flex: 0 0 auto;
  padding: 8px 0;
}

/* SKU 관리(신규) pagination */
#page-sku-new.active #skuv2-pagination {
  flex: 0 0 auto;
}

/* ════════════════════════════════════════════════════════════
   통합 사용 가이드 모달
   ════════════════════════════════════════════════════════════ */
.guide-modal {
  width: 980px;
  max-width: 95vw;
  max-height: 86vh;
  overflow: hidden;
}

.guide-header {
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
  gap: 12px;
}

.guide-subtitle {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guide-search { position: relative; display: flex; align-items: center; }

.guide-search i {
  position: absolute;
  left: 10px;
  font-size: 11px;
  color: #94a3b8;
  pointer-events: none;
}

.guide-search input {
  width: 180px;
  padding: 7px 10px 7px 28px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  background: #fff;
  transition: width 0.25s ease, box-shadow 0.15s;
}

.guide-search input:focus {
  outline: none;
  width: 230px;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  border-color: var(--primary);
}

.guide-body { display: flex; flex: 1; min-height: 0; }

/* 목차 */
.guide-toc {
  width: 232px;
  flex: 0 0 232px;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  padding: 12px 8px 16px;
  background: #fafbfc;
}

.guide-toc-group {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #94a3b8;
  text-transform: uppercase;
  padding: 12px 12px 5px;
}

.guide-toc-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  color: #475569;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, transform 0.14s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  animation: guideTocIn 0.3s ease backwards;
}

.guide-toc-item:hover { background: #eef2ff; color: var(--primary); transform: translateX(2px); }

.guide-toc-item.active {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.28);
}

.guide-toc-item i { width: 15px; text-align: center; font-size: 12px; opacity: 0.9; }

.guide-toc-item.is-new::after {
  content: 'NEW';
  margin-left: auto;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  background: #fb923c;
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
}

.guide-toc-item.active.is-new::after { background: rgba(255, 255, 255, 0.3); }

@keyframes guideTocIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* 본문 */
.guide-content { flex: 1; overflow-y: auto; padding: 22px 26px 30px; min-width: 0; }

.guide-page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 6px;
}

.guide-page-title .gpt-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.guide-page-lead {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.65;
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px dashed #e2e8f0;
}

.guide-sec {
  margin-bottom: 20px;
  animation: guideSecIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

@keyframes guideSecIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.guide-sec h4 {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin: 0 0 9px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.guide-sec h4::before {
  content: '';
  width: 4px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
  flex: 0 0 4px;
}

.guide-sec ul, .guide-sec ol {
  margin: 0;
  padding-left: 20px;
  font-size: 12.5px;
  color: #475569;
  line-height: 1.85;
}

.guide-sec li { margin-bottom: 4px; }
.guide-sec li b { color: #1e293b; }

.guide-sec code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11.5px;
  color: #be185d;
  font-family: ui-monospace, Consolas, monospace;
}

/* 단계 */
.guide-steps { counter-reset: gstep; padding: 0; margin: 0; list-style: none; }

.guide-steps li {
  position: relative;
  padding: 9px 12px 9px 40px;
  margin-bottom: 7px;
  background: #f8fafc;
  border: 1px solid #eef2f6;
  border-radius: 9px;
  font-size: 12.5px;
  color: #475569;
  line-height: 1.6;
  transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s;
}

.guide-steps li:hover {
  transform: translateX(3px);
  border-color: #c7d2fe;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.09);
}

.guide-steps li::before {
  counter-increment: gstep;
  content: counter(gstep);
  position: absolute;
  left: 11px;
  top: 9px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 표 */
.guide-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }

.guide-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  text-align: left;
  padding: 7px 9px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

.guide-table td { padding: 7px 9px; border: 1px solid #e2e8f0; color: #475569; line-height: 1.55; }
.guide-table tbody tr:nth-child(even) { background: #fafbfc; }

/* 강조 박스 */
.guide-callout {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 0 10px 10px 0;
  font-size: 12.5px;
  line-height: 1.65;
  margin-top: 12px;
}

.guide-callout i { margin-top: 2px; flex: 0 0 auto; }
.guide-callout.tip  { background: linear-gradient(135deg, #eef2ff, #f5f3ff); border-left: 3px solid var(--primary); color: #4338ca; }
.guide-callout.warn { background: linear-gradient(135deg, #fff7ed, #fffbeb); border-left: 3px solid #f59e0b; color: #92400e; }
.guide-callout.info { background: linear-gradient(135deg, #f0f9ff, #ecfeff); border-left: 3px solid #0ea5e9; color: #0c4a6e; }

/* 변경 이력 */
.guide-log { position: relative; padding-left: 18px; }

.guide-log::before {
  content: '';
  position: absolute;
  left: 4px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--primary), #e2e8f0);
  border-radius: 1px;
}

.guide-log-item { position: relative; padding: 0 0 14px 6px; animation: guideSecIn 0.4s ease backwards; }

.guide-log-item::before {
  content: '';
  position: absolute;
  left: -18px; top: 5px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
}

.guide-log-item:first-child::before {
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16);
  animation: guidePulse 2s ease-in-out infinite;
}

@keyframes guidePulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16); }
  50%      { box-shadow: 0 0 0 7px rgba(99, 102, 241, 0.05); }
}

.guide-log-date { font-size: 10.5px; font-weight: 700; color: var(--primary); letter-spacing: 0.3px; }
.guide-log-body { font-size: 12.5px; color: #475569; line-height: 1.7; margin-top: 2px; }
.guide-empty { padding: 40px 20px; text-align: center; color: #94a3b8; font-size: 13px; }

/* 사이드바 가이드 버튼 */
.guide-open-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border-radius: 9px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.16s, color 0.16s, transform 0.16s;
}

.guide-open-btn:hover { background: rgba(255, 255, 255, 0.13); color: #fff; transform: translateY(-1px); }

.guide-open-badge {
  margin-left: auto;
  min-width: 7px; height: 7px;
  border-radius: 50%;
  background: #fb923c;
  box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.22);
  animation: guidePulseDot 1.9s ease-in-out infinite;
}

.guide-open-badge.hidden { display: none; }

@keyframes guidePulseDot {
  0%, 100% { box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.22); }
  50%      { box-shadow: 0 0 0 6px rgba(251, 146, 60, 0.06); }
}

/* ════════════════════════════════════════════════════════════
   예외 관리(신규)
   ════════════════════════════════════════════════════════════ */
.nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9px;
  min-width: 18px;
  text-align: center;
}

.ex-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(186px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.ex-type-card {
  position: relative;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  padding: 12px 14px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s, border-color 0.18s;
  animation: exCardIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

@keyframes exCardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ex-type-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--ex-color, #94a3b8);
  transition: width 0.18s;
}

.ex-type-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.09);
  border-color: var(--ex-color, #94a3b8);
}

.ex-type-card:hover::before { width: 5px; }

.ex-type-card.active {
  border-color: var(--ex-color, #94a3b8);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
}

.ex-type-card .exc-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.ex-type-card .exc-label i { color: var(--ex-color, #94a3b8); font-size: 11px; }
.ex-type-card .exc-count { font-size: 22px; font-weight: 800; color: #0f172a; line-height: 1; }
.ex-type-card .exc-sub { font-size: 10.5px; color: #94a3b8; margin-top: 5px; display: flex; gap: 8px; }
.ex-type-card .exc-sub b { color: #ef4444; font-weight: 700; }
.ex-type-card .exc-sub b.done { color: #16a34a; }

.ex-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  color: #fff;
}

.ex-status {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 11px;
  padding: 3px 5px;
  width: 100%;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ex-status:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.14); }
.ex-status[data-s="대기"]  { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.ex-status[data-s="처리중"] { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.ex-status[data-s="완료"]  { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.ex-status[data-s="보류"]  { background: #f8fafc; border-color: #e2e8f0; color: #64748b; }

/* 컬럼이 많아 가로 스크롤을 허용 — 입력칸이 눌리지 않게 최소폭 확보.
   가로 스크롤은 표 안에서만 생기게 하고, 헤더/필터바는 화면 폭에 고정한다. */
#page-exception-new { min-width: 0; overflow-x: hidden; }
#page-exception-new .page-header,
#page-exception-new .filter-bar,
#page-exception-new .ex-type-grid { max-width: 100%; }
#page-exception-new .v2-table-wrap { max-width: 100%; min-width: 0; overflow-x: auto; }

.ex-table { min-width: 1740px; }
.ex-table td { vertical-align: middle; }
.ex-table .ex-status { font-size: 11px; padding: 3px 2px 3px 5px; }
.ex-table td.num, .ex-table th.num { text-align: right; }
.ex-table .ex-diff { font-weight: 700; color: #dc2626; }
.ex-table .ex-diff.zero { color: #94a3b8; font-weight: 400; }

.ex-table input.ex-inp,
.ex-table select.ex-inp {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 7px;
  font-size: 11.5px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.ex-table input.ex-inp:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.14);
  background: #fefeff;
}

.ex-table tr.ex-dirty { background: #fffbeb !important; }
.ex-table tr.ex-dirty td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.ex-table tr.ex-saved { animation: exSavedFlash 1.1s ease; }

@keyframes exSavedFlash {
  0%   { background: #dcfce7; }
  100% { background: transparent; }
}

.ex-order-link {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s;
}

.ex-order-link:hover { border-bottom-color: var(--primary); }

.ex-save-btn {
  border: none;
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: #eef2ff;
  color: var(--primary);
  transition: background 0.15s, transform 0.12s;
}

.ex-save-btn:hover { background: var(--primary); color: #fff; }
.ex-save-btn:active { transform: scale(0.94); }

.ex-empty { padding: 60px 20px; text-align: center; animation: guideSecIn 0.45s ease; }

.ex-empty-icon {
  font-size: 44px;
  color: #22c55e;
  margin-bottom: 12px;
  animation: exPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes exPop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.ex-empty h3 { margin: 0 0 6px; font-size: 15px; color: #1e293b; }
.ex-empty p { margin: 0; font-size: 12.5px; color: #94a3b8; }

.ex-detail-modal { width: 900px; max-width: 95vw; }
.ex-detail-sec { margin-bottom: 18px; animation: guideSecIn 0.4s ease backwards; }

.ex-detail-sec h4 {
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ex-detail-sec h4 .cnt {
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 5px;
  padding: 1px 6px;
}

/* ════════════════════════════════════════════════════════════
   공통 컨트롤 규격 — 검색 입력창 높이를 기준으로 전 페이지 통일
   ════════════════════════════════════════════════════════════ */
:root {
  --ctl-h: 40px;          /* 모든 입력/선택/버튼 높이 */
  --ctl-h-sm: 30px;       /* 표 안에서 쓰는 작은 컨트롤 */
  --ctl-fs: 13.5px;
  --ctl-radius: 8px;
  --ctl-border: #e2e8f0;
}

/* 필터바 / 페이지 헤더의 모든 컨트롤 */
.filter-bar input,
.filter-bar select,
.filter-bar button,
.filter-bar .btn,
.filter-bar .search-input input,
.header-actions .btn,
.page-header .btn,
.v2-tabs .btn {
  height: var(--ctl-h);
  min-height: var(--ctl-h);
  font-size: var(--ctl-fs);
  border-radius: var(--ctl-radius);
  box-sizing: border-box;
  line-height: 1.2;
}

.filter-bar input,
.filter-bar select,
.filter-bar .search-input input {
  padding: 0 12px;
  border: 1px solid var(--ctl-border);
  background-color: #fff;
  color: #1e293b;
}

.filter-bar .search-input input { padding-right: 36px; }

.filter-bar .btn,
.header-actions .btn,
.page-header .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  white-space: nowrap;
}

/* 드롭다운 — 기본 화살표 제거 후 직접 그려 글자 가림 방지 */
.filter-bar select,
select.ctl-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px 8px;
  text-overflow: ellipsis;
}

.filter-bar select:focus,
.filter-bar input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.13);
}

/* 필터바 레이아웃 — 좁아지면 줄바꿈해서 가로 스크롤이 안 생기게 */
.filter-bar { flex-wrap: wrap; align-items: flex-end; }
.filter-bar .filter-group { min-width: 0; }
.filter-bar .filter-group.search-group { flex: 1 1 220px; min-width: 180px; }
.filter-bar .search-input { position: relative; display: block; }
.filter-bar .search-input input { width: 100%; }

/* 표 안 작은 컨트롤 */
.ex-table input.ex-inp,
.ex-table select.ex-inp,
.ex-table .dp-input {
  height: var(--ctl-h-sm);
  min-height: var(--ctl-h-sm);
  font-size: 12px;
  box-sizing: border-box;
}

.ex-table select.ex-inp {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 24px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
}

.ex-save-btn { height: var(--ctl-h-sm); display: inline-flex; align-items: center; gap: 5px; }

/* ── 예외 표: 가로 스크롤 없이 화면 폭에 맞춤 ── */
#page-exception-new { min-width: 0; }
#page-exception-new .v2-table-wrap { max-width: 100%; min-width: 0; overflow-x: hidden; }

.ex-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

/* 내용은 절대 생략하지 않는다 — 좁으면 줄바꿈해서 전부 보여준다 */
.ex-table th, .ex-table td {
  padding: 7px 8px;
  font-size: 12px;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
  line-height: 1.4;
  vertical-align: middle;
}

.ex-table th { white-space: nowrap; }
.ex-table td.num, .ex-table th.num { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.ex-table td.ex-order { font-variant-numeric: tabular-nums; letter-spacing: -0.2px; }
.ex-table td.ex-period { font-variant-numeric: tabular-nums; font-size: 11.5px; color: #475569; }
.ex-table td.ex-period .to { color: #94a3b8; }

/* ════════════════════════════════════════════════════════════
   커스텀 날짜 선택기 (직접 입력 가능 · 9999년까지)
   ════════════════════════════════════════════════════════════ */
.dp-wrap { position: relative; display: block; }

.dp-input {
  width: 100%;
  height: var(--ctl-h);
  min-height: var(--ctl-h);
  box-sizing: border-box;
  padding: 0 34px 0 12px;
  border: 1px solid var(--ctl-border);
  border-radius: var(--ctl-radius);
  font-size: var(--ctl-fs);
  background: #fff;
  color: #1e293b;
  font-variant-numeric: tabular-nums;
}

.dp-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.13);
}

.dp-input::placeholder { color: #cbd5e1; }

.dp-btn {
  position: absolute;
  right: 1px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: calc(100% - 4px);
  border: none;
  background: none;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 0 var(--ctl-radius) var(--ctl-radius) 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: color 0.14s, background 0.14s;
}

.dp-btn:hover { color: var(--primary); background: #f8fafc; }
.ex-table .dp-btn { width: 24px; font-size: 11px; }
.ex-table .dp-input { padding: 0 26px 0 7px; }

/* 팝업 */
.dp-pop {
  position: fixed;
  z-index: 12000;
  width: 268px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.18);
  padding: 12px;
  animation: dpIn 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes dpIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dp-head {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
}

.dp-nav {
  width: 26px; height: 26px;
  flex: 0 0 26px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 7px;
  color: #64748b;
  cursor: pointer;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.14s;
}

.dp-nav:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

.dp-y {
  width: 60px;
  height: 26px;
  text-align: center;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
  padding: 0 2px;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.dp-y::-webkit-outer-spin-button,
.dp-y::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dp-y:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99,102,241,0.14); }

.dp-m {
  flex: 1;
  height: 26px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
  padding: 0 22px 0 8px;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  cursor: pointer;
}

.dp-m:focus { outline: none; border-color: var(--primary); }

.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }

.dp-dow {
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  color: #94a3b8;
  padding: 4px 0 6px;
}

.dp-dow.sun { color: #ef4444; }
.dp-dow.sat { color: #3b82f6; }

.dp-day {
  height: 30px;
  border: none;
  background: none;
  border-radius: 7px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background 0.12s, color 0.12s, transform 0.1s;
}

.dp-day:hover { background: #eef2ff; color: var(--primary); }
.dp-day:active { transform: scale(0.92); }
.dp-day.other { color: #cbd5e1; }
.dp-day.sun { color: #ef4444; }
.dp-day.sat { color: #3b82f6; }
.dp-day.other.sun, .dp-day.other.sat { color: #e2e8f0; }

.dp-day.today {
  box-shadow: inset 0 0 0 1.5px #c7d2fe;
  font-weight: 700;
}

.dp-day.sel {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.3);
}

.dp-foot {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.dp-foot button {
  flex: 1;
  height: 28px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 7px;
  font-size: 11.5px;
  color: #475569;
  cursor: pointer;
  transition: all 0.14s;
}

.dp-foot button:hover { background: #f8fafc; border-color: #cbd5e1; color: #1e293b; }
.dp-foot button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.dp-foot button.primary:hover { filter: brightness(1.08); }

.dp-hint {
  font-size: 10.5px;
  color: #94a3b8;
  text-align: center;
  margin-top: 7px;
}

/* 예외 표 — 처리내용 셀 / 필터바 최소폭 */
.ex-table .ex-memo { color: #475569; }
.filter-bar .filter-group { min-width: 118px; }
.filter-bar .filter-group.search-group { flex: 1 1 240px; min-width: 200px; }
.ex-table .ex-status { padding: 3px 20px 3px 6px; }

/* 예외 표 미세조정 — 측정값 기준 (잘림 0) */
.ex-table td.ex-order { font-size: 11.5px; letter-spacing: -0.3px; }
.ex-table .ex-badge { font-size: 10px; padding: 3px 6px; letter-spacing: -0.2px; }
.ex-table .ex-badge i { margin-right: 2px; }
.ex-table td:first-child, .ex-table th:first-child { padding-left: 10px; padding-right: 4px; }
.ex-table .ex-memo { white-space: normal; line-height: 1.45; color: #475569; }

/* 예외 표 — 폭/폰트는 EXFIT 이 계산해서 주입 (생략 없음) */
.ex-table { --ex-fs: 12px; }
.ex-table th, .ex-table td { font-size: var(--ex-fs); }
.ex-table td.ex-order { font-size: calc(var(--ex-fs) - 0.5px); }
.ex-table td.ex-period { font-size: calc(var(--ex-fs) - 0.5px); }
.ex-table .ex-badge { font-size: calc(var(--ex-fs) - 2px); }
.ex-table select.ex-inp { font-size: calc(var(--ex-fs) - 0.5px); }
.ex-table .ex-save-btn { font-size: calc(var(--ex-fs) - 0.5px); }
.ex-table th, .ex-table td { overflow: visible; text-overflow: clip; }

/* ════════════════════════════════════════════════════════════
   컴팩트 패스 — 화면 밀도를 전체적으로 한 단계 높인다
   (이 블록이 항상 마지막에 오므로 앞선 값들을 덮어쓴다)
   ════════════════════════════════════════════════════════════ */
:root {
  --sidebar-width: 196px;
  --ctl-h: 34px;
  --ctl-h-sm: 27px;
  --ctl-fs: 12.5px;
  --ctl-radius: 7px;
}

/* ── 사이드바 ── */
.logo {
  padding: 14px 16px;
  font-size: 1.02rem;
  gap: 9px;
}

.logo i { font-size: 1.05rem; }

.nav-menu { padding: 8px 0; }

.nav-item {
  gap: 9px;
  padding: 8px 16px;
  font-size: 12.8px;
}

.nav-item i { width: 16px; font-size: 13px; }

.nav-group-label { padding: 9px 16px 3px !important; font-size: 9.5px !important; }

.sidebar-footer { padding: 10px 12px; }
.sidebar-footer small { font-size: 10px; }

.guide-open-btn { padding: 7px 10px; font-size: 11.8px; margin-bottom: 6px; }

/* ── 본문 여백 ── */
.main-content { padding: 14px 16px; }

.page-header { margin-bottom: 12px; }

.page-header h1 { font-size: 1.16rem; gap: 8px; }

.page-desc { font-size: 11.5px; line-height: 1.5; }

.page-help-toggle { width: 20px; height: 20px; font-size: 11px; }

.header-actions { gap: 7px; }

/* ── 필터바 ── */
.filter-bar {
  gap: 9px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 9px;
}

.filter-group label { font-size: 10.5px; margin-bottom: 3px; }

/* ── 통계 카드 ── */
.stats-row-compact { gap: 8px; margin-bottom: 10px; }

.stat-card.compact { padding: 8px 12px; border-radius: 9px; }
.stat-card.compact .stat-label { font-size: 10.5px; }
.stat-card.compact .stat-value { font-size: 17px; }

.stat-card { padding: 14px; border-radius: 10px; gap: 12px; }
.stat-icon { width: 42px; height: 42px; font-size: 1rem; }
.stat-info h3 { font-size: 1.28rem; }
.stat-info p { font-size: 11.5px; }

/* ── 표 ── */
.data-table th { padding: 8px 9px; font-size: 11.5px; }
.data-table td { padding: 7px 9px; font-size: 12px; }

.v2-table-wrap { border-radius: 9px; }
.v2-pagination { padding: 7px 0; font-size: 12px; }

/* ── 버튼 ── */
.btn { font-size: 12.5px; border-radius: 7px; }
.btn.btn-sm { height: 28px; min-height: 28px; font-size: 11.5px; padding: 0 10px; }

/* ── 예외 페이지 ── */
.ex-type-grid { gap: 8px; margin-bottom: 10px; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }
.ex-type-card { padding: 9px 11px; border-radius: 9px; }
.ex-type-card .exc-label { font-size: 10.8px; margin-bottom: 4px; }
.ex-type-card .exc-count { font-size: 18px; }
.ex-type-card .exc-sub { font-size: 10px; margin-top: 4px; }

.ex-empty { padding: 40px 20px; }
.ex-empty-icon { font-size: 36px; }

/* ── 모달 ── */
.modal-header { padding: 13px 16px; }
.modal-header h2, .modal-header h3 { font-size: 1rem; }
.modal-body { padding: 14px 16px; }
.modal-footer { padding: 11px 16px; }

.guide-modal { max-height: 88vh; }
.help-modal-header { padding: 13px 16px 11px; }
.help-modal-header h2 { font-size: 1rem; }
.help-modal-icon { width: 30px; height: 30px; font-size: 0.88rem; }
.guide-toc { width: 200px; flex: 0 0 200px; padding: 8px 6px 12px; }
.guide-toc-item { padding: 6px 10px; font-size: 12px; }
.guide-toc-group { padding: 9px 10px 4px; }
.guide-content { padding: 16px 18px 22px; }
.guide-page-title { font-size: 15px; }
.guide-page-lead { font-size: 12px; margin-bottom: 14px; padding-bottom: 11px; }
.guide-sec { margin-bottom: 16px; }
.guide-sec h4 { font-size: 12.5px; margin-bottom: 7px; }
.guide-sec ul, .guide-sec ol { font-size: 12px; line-height: 1.75; }
.guide-steps li { padding: 7px 11px 7px 36px; font-size: 12px; margin-bottom: 6px; }
.guide-steps li::before { width: 18px; height: 18px; left: 10px; top: 8px; font-size: 10px; }
.guide-table th, .guide-table td { padding: 6px 8px; font-size: 11.5px; }
.guide-callout { padding: 9px 12px; font-size: 12px; }

/* ── 토스트 ── */
.toast { font-size: 12.5px; padding: 10px 16px; }

/* 예외 표 — 채널 한 줄, 행 높이 축소로 화면당 행수 확보 */
.ex-table td.ex-ch { white-space: nowrap; }
.ex-table th, .ex-table td { padding: 4px 8px; }
.ex-table td { line-height: 1.3; }
.ex-table .ex-badge { padding: 2px 6px; }
.ex-table select.ex-inp, .ex-table .ex-save-btn { height: 24px; min-height: 24px; }
/* 라벨 없는 필터바 — 컨트롤만 한 줄로 */
#page-exception-new .filter-bar { align-items: center; }
#page-exception-new .filter-bar .filter-group { min-width: 132px; }
#page-exception-new .filter-bar .filter-group.search-group { flex: 1 1 260px; }

/* ── 예외 대량 처리 모달 ── */
.ex-bulk-modal { width: 620px; max-width: 94vw; }

.exb-sec {
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fcfdfe;
  animation: guideSecIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.exb-sec:nth-child(1) { animation-delay: 0ms; }
.exb-sec:nth-child(2) { animation-delay: 55ms; }
.exb-sec:nth-child(3) { animation-delay: 110ms; }

.exb-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 9px;
}

.exb-opt { font-weight: 500; color: #94a3b8; font-size: 11px; }

.exb-radio, .exb-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: #475569;
  cursor: pointer;
  padding: 5px 0;
  margin: 0;
}

.exb-radio input, .exb-check input { cursor: pointer; margin: 0; }
.exb-radio b { color: var(--primary); font-weight: 700; }
.exb-radio input:disabled + span { color: #cbd5e1; }
.exb-radio input:disabled + span b { color: #cbd5e1; }

.exb-lbl {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 4px;
}

.exb-inp {
  height: 32px;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 12.5px;
  background: #fff;
  color: #1e293b;
}

select.exb-inp { padding-right: 28px; }

.exb-inp:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.13);
}

.exb-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 7px;
  line-height: 1.5;
}

.exb-result {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 12.5px;
  background: #f1f5f9;
  color: #475569;
  border-left: 3px solid #cbd5e1;
  transition: background 0.18s, border-color 0.18s;
}

.exb-result b { font-weight: 800; }
.exb-result.ok   { background: linear-gradient(135deg,#eef2ff,#f5f3ff); border-left-color: var(--primary); color: #4338ca; }
.exb-result.warn { background: linear-gradient(135deg,#fff7ed,#fffbeb); border-left-color: #f59e0b; color: #92400e; }

#exb-apply-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* 자사몰 매핑 — 0원 사유 표시 */
.mv2-zbadge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.mv2-zero { color: #d97706; font-weight: 700; background: #fffbeb; }
.mv2-refund { color: #dc2626; }
.mv2-na { color: #cbd5e1; }
#mallv2-table td, #mallv2-table th { font-size: 11.5px; }
#mallv2-table th.num, #mallv2-table td.text-right { text-align: right; }

/* ════════════════════════════════════════════════════════════
   스타일 통일 — [예외 관리(신규)] 기준
   ════════════════════════════════════════════════════════════ */

/* ── 통계 카드 : 예외 관리의 ex-type-card 와 동일한 형태 ── */
.stats-row-compact {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.stat-card.compact {
  position: relative;
  flex: 1 1 148px;
  min-width: 132px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 12px 9px 15px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  overflow: hidden;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s, border-color 0.18s;
  animation: exCardIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.stat-card.compact::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--sc-color, #6366f1);
  transition: width 0.18s;
}

.stat-card.compact:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.09);
  border-color: var(--sc-color, #6366f1);
}

.stat-card.compact:hover::before { width: 5px; }

.stat-card.compact .stat-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: -0.1px;
}

.stat-card.compact .stat-value {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ── 필터바 : 라벨 없는 한 줄 배치 ── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 10px;
  box-shadow: none;
}

.filter-bar .filter-group {
  display: flex;
  flex-direction: column;
  min-width: 132px;
}

.filter-bar .filter-group.fg-unlabeled { justify-content: center; }

.filter-bar .filter-group.search-group {
  flex: 1 1 240px;
  min-width: 200px;
}

.filter-bar .filter-group .dp-wrap { min-width: 148px; }

/* 라벨이 살아있는 곳(직접 넣은 것)은 컴팩트하게 */
.filter-bar label {
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 3px;
}

.filter-bar .btn { flex: 0 0 auto; }

/* ── 표 헤더/셀도 동일 밀도 ── */
.v2-table-wrap .data-table th {
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
  padding: 7px 8px;
}

.v2-table-wrap .data-table td {
  font-size: 12px;
  padding: 5px 8px;
}

/* ── 페이지네이션 ── */
.v2-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 0;
  font-size: 12px;
}

/* v2 표 자동맞춤 — 측정 모드 / 폰트 변수 */
.v2-table-wrap table.data-table { --v2-fs: 12px; }
.v2-table-wrap .data-table th,
.v2-table-wrap .data-table td {
  font-size: var(--v2-fs);
  padding: 4px 8px;
  line-height: 1.35;
  vertical-align: middle;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
  overflow: visible;
  text-overflow: clip;
}
.v2-table-wrap .data-table th { white-space: nowrap; font-weight: 700; color: #334155; }
.v2-table-wrap .data-table td.text-right,
.v2-table-wrap .data-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

table.v2-measuring { table-layout: auto !important; width: max-content !important; }
table.v2-measuring th, table.v2-measuring td { white-space: nowrap !important; }
table.v2-measuring colgroup { display: none; }

/* 레거시 ID 규칙(#salesv2-table td 등)이 nowrap 을 강제해 긴 글자가 잘린다.
   v2 표 안에서는 줄바꿈을 허용해 전부 보이게 한다. 숫자 컬럼만 한 줄 유지. */
.v2-table-wrap table.data-table td { white-space: normal !important; }
.v2-table-wrap table.data-table th { white-space: nowrap !important; }
.v2-table-wrap table.data-table td.text-right,
.v2-table-wrap table.data-table td.num,
.v2-table-wrap table.data-table td.ex-ch { white-space: nowrap !important; }
table.v2-measuring th, table.v2-measuring td { white-space: nowrap !important; }

/* SKU/상품 관리 카드 안 버튼 배치 */
.stat-card.compact .btn.btn-sm { height: 24px; min-height: 24px; padding: 0 8px; font-size: 11px; }
.stats-row-compact .stat-card.compact:has(.btn) { min-width: 0; }

/* 카드 수가 적을 때 한 장이 화면 전체로 늘어나지 않게 */
.stats-row-compact .stat-card.compact { max-width: 280px; }
/* 표 안 버튼은 줄바꿈 금지 */
.v2-table-wrap .data-table td .btn,
.v2-table-wrap .data-table td button { white-space: nowrap; }
.v2-table-wrap .data-table td.action-col { white-space: nowrap !important; }

/* 페이지 헤더 — page-desc 의 음수 margin-top 해킹 제거 (컴팩트 패딩과 겹쳐 글자가 잘렸음) */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-bottom: 12px;
}
.page-header h1 { flex: 0 0 auto; margin: 0; }
.page-header .page-desc {
  margin: 0 !important;
  flex: 1 1 300px;
  min-width: 0;
  color: #64748b;
}
.page-header .header-actions { flex: 0 0 auto; margin-left: auto; flex-wrap: wrap; }

/* 기존 메뉴(.table-container) 표도 긴 글자를 자르지 않고 줄바꿈해서 전부 보여준다 */
.table-container .data-table td { white-space: normal !important; word-break: keep-all; overflow-wrap: anywhere; }
.table-container .data-table th { white-space: nowrap !important; }
.table-container .data-table td.text-right,
.table-container .data-table td.num,
.table-container .data-table td.action-col { white-space: nowrap !important; }
.table-container .data-table td .btn,
.table-container .data-table td button { white-space: nowrap; }
