@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');.sidebar {
  /* fixed 로 페이지 위에 띄움 — flex item 일 때와 달리 hover 펼침이 페이지 layout 에 영향 안 줌.
     페이지 안 밀어내므로 다른 컴포넌트의 ResizeObserver 가 발화하지 않아 무거운 그리드에서 렉 0. */
  position: fixed;
  top: 0;
  left: 0;
  width: 88px;
  height: 100vh;
  background: var(--color-primary-bg);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.15s ease;
  /* TopNavBar 의 z-index: 100 보다 높게 — 사이드바가 위에 그려져야 종모양/로그아웃 바에 안 가림 */
  z-index: 200;
}

.sidebar:hover {
  width: 240px;
}

/* 페이지 이동 후 500ms — pointer-events:none 으로 :hover 차단 → 자동으로 88px 로 접힘.
   마우스가 사이드바 영역 밖에 한 번 나갔다 다시 들어오면 다시 hover 동작. */
.sidebar.collapsing { pointer-events: none; }
.sidebar.collapsing:hover { width: 88px; }

/* 로고 */
.sidebar-logo {
  display: flex;
  align-items: center;
  padding: 24px 0 20px 26px;
  min-height: 72px;
  gap: 12px;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  display: none;
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}

.sidebar:hover .sidebar-logo-text {
  display: block;
}

/* 메뉴 리스트 */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  gap: 2px;
}

/* 아이콘 크기 고정 */
.sidebar-item svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

/* 메뉴 아이템 — 아이콘 위치 항상 고정 */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 12px 12px 18px;
  border-radius: var(--radius-md);
  color: var(--color-text-dim);
  font-size: 15px;
  font-weight: 400;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.sidebar-item:hover {
  background: var(--color-primary-border);
}

.sidebar-item.active {
  color: var(--color-text);
  font-weight: 700;
  background: var(--color-primary-border);
}

/* 접혀있을 때: 텍스트와 뱃지 완전히 숨김 */
.sidebar-label {
  display: none;
}

.sidebar-badge-soon {
  display: none;
}

/* 펼쳤을 때: 텍스트와 뱃지 표시 */
.sidebar:hover .sidebar-label {
  display: block;
  font-weight: 600;
}

.sidebar:hover .sidebar-badge-soon {
  display: block;
  margin-left: auto;
  font-size: 10px;
  padding: 2px 6px;
  background: #dedad0;
  border-radius: 4px;
  color: var(--color-text-secondary);
  font-weight: 400;
}

/* Phase6+ */
.sidebar-item.phase6 {
  opacity: 0.4;
}

/* 구분선 */
.sidebar-divider {
  height: 1px;
  background: #dedad0;
  margin: 8px 4px;
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
}
/* ============================================
   Bottom Tabs (모바일 only, PC에서 숨김)
   ============================================ */

.bottom-tabs {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  /* 높이 = 컨텐츠 높이 + safe-area. padding-bottom 으로 safe-area 분을 띄워서
     아이콘이 홈인디케이터/시스템 바 영역에 침범하지 않게. PWA standalone 에서 중요. */
  height: calc(var(--bottomtab-height) + env(safe-area-inset-bottom, 0px));
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
  z-index: 100;
}

.bottom-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  color: var(--color-text-secondary);
  font-size: 10px;
  font-weight: 500;
  transition: color 0.15s ease;
  flex: 1;
}

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

/* 더보기 오버레이 */
.bottom-more-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  align-items: flex-end;
}

.bottom-more-sheet {
  width: 100%;
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0));
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.bottom-more-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.bottom-more-header button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
}

.bottom-more-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.bottom-more-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 4px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text);
  transition: background 0.15s ease;
  position: relative;
}

.bottom-more-item:hover {
  background: var(--color-bg);
}

.bottom-more-item.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.bottom-more-item.phase6 {
  opacity: 0.5;
}

.bottom-more-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 8px;
  padding: 1px 4px;
  background: var(--color-border);
  border-radius: 3px;
  color: var(--color-text-secondary);
}

/* 모바일에서만 표시 */
@media (max-width: 768px) {
  .bottom-tabs {
    display: flex;
  }

  .bottom-more-overlay {
    display: flex;
  }
}

.notif-bell {
  position: relative;
  display: inline-flex;
}

.notif-bell-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  position: relative;
}
.notif-bell-btn:hover { background: #f3f4f6; border-color: #e5e7eb; color: #111827; }

/* 알림 도착 시 벨 흔들기 */
.notif-bell-btn.shake { animation: notif-shake 0.9s cubic-bezier(.36,.07,.19,.97); transform-origin: top center; }
@keyframes notif-shake {
  0%,100% { transform: rotate(0); }
  10%,30%,50%,70% { transform: rotate(-14deg); }
  20%,40%,60%,80% { transform: rotate(14deg); }
  90% { transform: rotate(-6deg); }
}

/* 안 읽은 알림 있으면 벨 계속 강조 — 빨간 벨 + 은은한 펄스 글로우 (눈에 띄게) */
.notif-bell-btn.has-unread {
  color: #ef4444;
  background: #fef2f2;
  border-color: #fecaca;
  animation: notif-pulse 1.8s ease-in-out infinite;
}
.notif-bell-btn.has-unread:hover { background: #fee2e2; color: #dc2626; }
@keyframes notif-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.45); }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

.notif-bell-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  min-width: 19px;
  height: 19px;
  border-radius: 10px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(239,68,68,0.5);
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 460px;
  max-height: 600px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 모바일 — 화면 너비 안에 맞춤 */
@media (max-width: 520px) {
  .notif-dropdown {
    position: fixed;
    top: 56px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100vh - 80px);
  }
}

.notif-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}
.notif-clear {
  background: transparent;
  border: none;
  font-size: 11px;
  color: #6b7280;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.notif-clear:hover { background: #f3f4f6; color: #111827; }

.notif-empty {
  padding: 30px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
}

.notif-list {
  overflow-y: auto;
  flex: 1;
}

.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
}
.notif-item:hover { background: #f9fafb; }
.notif-item:last-child { border-bottom: none; }

.notif-item.new_order .notif-item-icon { background: #dbeafe; color: #1d4ed8; }
.notif-item.cancel_request .notif-item-icon { background: #fee2e2; color: #b91c1c; }
.notif-item.cancel .notif-item-icon { background: #f1f5f9; color: #475569; }
.notif-item.pending .notif-item-icon { background: #fef3c7; color: #b45309; }
.notif-item.pending_done .notif-item-icon { background: #d1fae5; color: #047857; }

.notif-item-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.notif-item-body { flex: 1; min-width: 0; }

.notif-item-title {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.notif-item-time { font-size: 10px; color: #9ca3af; font-weight: 400; }

.notif-item-sn {
  font-size: 11px;
  color: #4b5563;
  font-family: ui-monospace, monospace;
  margin-bottom: 2px;
}
.notif-item-shop {
  font-weight: 700;
  color: #111827;
  font-family: inherit;
}

.notif-item-summary {
  font-size: 11.5px;
  color: #4b5563;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  margin-top: 4px;
  background: #f9fafb;
  padding: 6px 8px;
  border-radius: 6px;
  border-left: 2px solid #e5e7eb;
}

.notif-item-x {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 4px;
  border-radius: 4px;
  align-self: flex-start;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s;
}
.notif-item:hover .notif-item-x { opacity: 1; }
.notif-item-x:hover { background: #fee2e2; color: #b91c1c; }

/* ===== 토스트 (화면 우상단 슬라이드 인) ===== */
.notif-toast-wrap {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 340px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.notif-toast {
  position: relative;
  pointer-events: auto;
  display: flex;
  gap: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 5px solid #9ca3af;
  border-radius: 10px;
  box-shadow: 0 10px 34px rgba(0,0,0,0.22);
  padding: 13px 12px 15px 14px;
  cursor: pointer;
  overflow: hidden;
  animation: notif-toast-in 0.32s cubic-bezier(.21,1.02,.73,1);
}
/* 하단 진행바 — 20초 동안 서서히 줄어듦 (언제 사라질지 보이게) */
.notif-toast::after {
  content: '';
  position: absolute; left: 0; bottom: 0; height: 3px;
  background: currentColor; opacity: 0.45;
  width: 100%;
  transform-origin: left;
  animation: notif-toast-progress 20s linear forwards;
}
.notif-toast.new_order::after { color: #2563eb; }
.notif-toast.pending::after { color: #d97706; }
.notif-toast.pending_done::after { color: #059669; }
.notif-toast.cancel_request::after { color: #dc2626; }
.notif-toast.cancel::after { color: #64748b; }
@keyframes notif-toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.notif-toast:hover { background: #fafafa; }
.notif-toast.new_order      { border-left-color: #2563eb; }
.notif-toast.pending        { border-left-color: #d97706; }
.notif-toast.pending_done   { border-left-color: #059669; }
.notif-toast.cancel_request { border-left-color: #dc2626; }
.notif-toast.cancel         { border-left-color: #64748b; }

@keyframes notif-toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

.notif-toast-icon {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #f3f4f6; color: #374151;
}
.notif-toast.new_order .notif-toast-icon { background: #dbeafe; color: #1d4ed8; }
.notif-toast.pending .notif-toast-icon { background: #fef3c7; color: #b45309; }
.notif-toast.pending_done .notif-toast-icon { background: #d1fae5; color: #047857; }
.notif-toast.cancel_request .notif-toast-icon { background: #fee2e2; color: #b91c1c; }
.notif-toast.cancel .notif-toast-icon { background: #f1f5f9; color: #475569; }

.notif-toast-body { flex: 1; min-width: 0; }
.notif-toast-title { font-size: 12.5px; font-weight: 700; color: #111827; margin-bottom: 2px; }
.notif-toast-sn { font-size: 11px; color: #4b5563; font-family: ui-monospace, monospace; margin-bottom: 3px; }
.notif-toast-sn strong { font-family: inherit; color: #111827; font-weight: 700; }
.notif-toast-summary {
  font-size: 11px; color: #6b7280; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notif-toast-x {
  flex-shrink: 0;
  background: transparent; border: none; cursor: pointer;
  color: #9ca3af; padding: 2px; border-radius: 4px; align-self: flex-start;
}
.notif-toast-x:hover { background: #f3f4f6; color: #111827; }

@media (max-width: 520px) {
  .notif-toast-wrap { top: 56px; right: 8px; left: 8px; width: auto; }
}

/* ═══ 8/26 형: 종 창·토스트 크게 + [주문][시스템] 탭 + 폰 최적화 ═══ */
.notif-dropdown { width: 560px; max-height: 70vh; border-radius: 14px; box-shadow: 0 14px 44px rgba(0,0,0,0.16); }
.notif-dropdown-head { padding: 8px 12px 8px 8px; font-size: 14.5px; }
.notif-tabs { display: flex; gap: 2px; }
.notif-tab { position: relative; border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-size: 14.5px; font-weight: 700; color: #6b7280; cursor: pointer; font-family: inherit; }
.notif-tab.active { background: #111827; color: #fff; }
.notif-tab-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; border: 2px solid #fff; }
.notif-clear { font-size: 13px; padding: 6px 10px; }
.notif-empty { padding: 44px 16px; font-size: 14px; }
.notif-item { gap: 12px; padding: 13px 16px; }
.notif-item-icon { width: 36px; height: 36px; }
.notif-item-title { font-size: 14.5px; margin-bottom: 3px; }
.notif-item-time { font-size: 12px; }
.notif-item-sn { font-size: 13px; margin-bottom: 3px; }
.notif-item-summary { font-size: 13.5px; line-height: 1.5; padding: 8px 10px; }
.notif-item-kind { font-size: 12px; color: #6b7280; margin-bottom: 3px; }
.notif-item-x { padding: 6px; }
.notif-item.system .notif-item-icon { background: #fef3c7; color: #b45309; }
.notif-item.system.research_captcha .notif-item-icon { background: #fee2e2; color: #b91c1c; }
.notif-item.system.backup_failed .notif-item-icon, .notif-item.system.rate_failed .notif-item-icon { background: #fee2e2; color: #b91c1c; }
.notif-item.system.token_expiring .notif-item-icon { background: #ede9fe; color: #6d28d9; }
/* 토스트 크게 */
.notif-toast-wrap { width: 420px; gap: 12px; }
.notif-toast { padding: 15px 14px 17px 16px; gap: 12px; border-radius: 12px; }
.notif-toast-icon { width: 36px; height: 36px; }
.notif-toast-title { font-size: 15px; margin-bottom: 3px; }
.notif-toast-sn { font-size: 13.5px; margin-bottom: 4px; }
.notif-toast-summary { font-size: 13.5px; line-height: 1.45; }
.notif-toast.system { border-left-color: #d97706; }
.notif-toast.system::after { color: #d97706; }
.notif-toast.system .notif-toast-icon { background: #fef3c7; color: #b45309; }
.notif-toast-x { padding: 4px; }
/* 폰: 창은 가로 꽉(좌우 8px), 세로 80%, 토스트 상단 가로 꽉 */
@media (max-width: 768px) {
  .notif-dropdown { position: fixed; top: 60px; left: 8px; right: 8px; width: auto; max-height: 80vh; max-height: 80dvh; z-index: 10000; }
  .notif-item { padding: 13px 14px; }
  .notif-item-x { opacity: 1; }
  .notif-toast-wrap { top: 60px; right: 8px; left: 8px; width: auto; z-index: 10001; }
}
/* ============================================
   Top Navigation Bar
   ============================================ */

.topbar {
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

/* 모바일 로고 (PC에서 숨김) */
.topbar-mobile-logo {
  display: none;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}

.topbar-logo-icon {
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.topbar-logo-text {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
}

/* 오른쪽 영역 */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 알림 벨 */
.topbar-bell {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
}

.topbar-bell:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.topbar-bell-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* 실시간 접속자 표시 — 아바타 스택. 호버 시 누가 어디 보고 있는지 tooltip. */
.topbar-presence {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  background: var(--color-primary-bg);
  border: 1px solid var(--color-primary-border);
  border-radius: 999px;
}
.topbar-presence-stack {
  display: flex;
  align-items: center;
}
.topbar-presence-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--color-surface);
  object-fit: cover;
  margin-left: -8px;
}
.topbar-presence-avatar:first-child { margin-left: 0; }
.topbar-presence-fallback {
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.topbar-presence-more {
  margin-left: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
}
@media (max-width: 768px) {
  .topbar-presence { display: none; }
}

/* 프로필 */
.topbar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.topbar-avatar-fallback {
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.topbar-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
}

.topbar-logout {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.topbar-logout:hover {
  background: var(--color-bg);
  color: var(--color-danger);
}

/* 새로고침 버튼 — 모바일 전용 (PC 에선 숨김) */
.topbar-refresh {
  display: none;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
.topbar-refresh:active {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

/* 모바일 */
@media (max-width: 768px) {
  .topbar {
    padding: 0 16px;
  }

  .topbar-mobile-logo {
    display: flex;
  }

  .topbar-name {
    display: none;
  }

  .topbar-refresh {
    display: inline-flex;
  }
}

/* 채팅 매크로 바
   - full 모드: 입력창 위 가로 스크롤 칩 + ⚡ 열기 버튼 (ChatPage)
   - compact 모드: ⚡ 버튼만 (BuyerChatPopup, ChatMobile) */

.cmacro-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}
.cmacro-bar.compact { padding: 7px 10px; }

.cmacro-chips {
  flex: 1;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.cmacro-chips::-webkit-scrollbar { display: none; }

.cmacro-empty {
  font-size: 11.5px;
  color: var(--color-text-muted);
  padding: 5px 2px;
  white-space: nowrap;
}

/* 매크로 칩 — 라벨만 보이는 둥근 알약 (full/compact 공통) */
.cmacro-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border: 1px solid var(--color-primary-border, #c7d2fe);
  border-radius: 16px;
  background: var(--color-primary-bg, #eef2ff);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.cmacro-chip:hover:not(:disabled) {
  background: var(--color-primary, #6366f1);
  border-color: var(--color-primary, #6366f1);
}
.cmacro-chip:hover:not(:disabled) .cmacro-label { color: #fff; }
.cmacro-chip:active:not(:disabled) { transform: scale(0.96); }
.cmacro-chip:disabled { opacity: 0.5; cursor: not-allowed; }

.cmacro-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-primary, #6366f1);
  line-height: 1.2;
}

/* ⚡ 매크로 관리 버튼 — 항상 동그란 아이콘 버튼 */
.cmacro-open {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary, #6366f1);
  border: none;
  color: #fff;
  cursor: pointer;
  transition: all 0.12s;
  box-shadow: 0 2px 6px rgba(99,102,241,0.3);
}
.cmacro-open:hover { background: var(--color-primary-hover, #4f46e5); transform: translateY(-1px); }
.cmacro-open.compact { width: 30px; height: 30px; }

/* ── 매크로 모달 ── */
.cmacro-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.cmacro-modal {
  width: 100%;
  max-width: 640px;
  max-height: 86vh;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cmacro-modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: var(--color-text);
  font-size: var(--font-size-lg);
}
.cmacro-modal-header button {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cmacro-modal-header button:hover { background: var(--color-bg); color: var(--color-text); }

.cmacro-modal-body {
  padding: 14px 18px 18px;
  overflow-y: auto;
}

.cmacro-modal-empty {
  padding: 30px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

/* 큰 칩 그리드 */
.cmacro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.cmacro-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.cmacro-card:hover:not(.editing) {
  border-color: var(--color-primary-border);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}
.cmacro-card.editing {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}

/* 큰 칩 본체 — 클릭 시 전송 */
.cmacro-card-send {
  flex: 1;
  text-align: left;
  padding: 12px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 70px;
  transition: background 0.12s;
}
.cmacro-card-send:hover:not(:disabled) { background: var(--color-primary-bg); }
.cmacro-card-send:active:not(:disabled) { background: var(--color-primary-border); }
.cmacro-card-send:disabled { opacity: 0.5; cursor: not-allowed; }

.cmacro-card-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}
.cmacro-card-text {
  font-size: 12px;
  color: var(--color-text-dim);
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 카드 하단 액션 바 */
.cmacro-card-actions {
  display: flex;
  gap: 4px;
  padding: 6px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  justify-content: flex-end;
}
.cmacro-card-actions button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.cmacro-card-actions button:hover:not(:disabled) {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border-color: var(--color-primary-border);
}
.cmacro-card-actions button:disabled { opacity: 0.4; cursor: not-allowed; }
.cmacro-card-actions .cmacro-btn-del {
  color: var(--color-danger);
}
.cmacro-card-actions .cmacro-btn-del:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

/* 인라인 편집 폼 */
.cmacro-edit-form {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cmacro-input,
.cmacro-textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 13px;
  color: var(--color-text);
  outline: none;
  font-family: inherit;
}
.cmacro-input:focus,
.cmacro-textarea:focus { border-color: var(--color-primary); }
.cmacro-textarea { resize: vertical; min-height: 60px; }

.cmacro-edit-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.cmacro-edit-actions button {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--color-surface);
  color: var(--color-text);
  transition: all 0.12s;
}
.cmacro-btn-ok {
  background: var(--color-primary) !important;
  color: #fff !important;
  border-color: var(--color-primary) !important;
}
.cmacro-btn-ok:hover { background: var(--color-primary-hover) !important; }
.cmacro-btn-cancel:hover { background: var(--color-bg); }

/* + 추가 버튼 (모달 하단) */
.cmacro-btn-add {
  margin-top: 14px;
  width: 100%;
  padding: 12px;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.12s;
}
.cmacro-btn-add:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-bg);
}

/* 모바일 */
@media (max-width: 768px) {
  .cmacro-grid { grid-template-columns: 1fr; }
  .cmacro-modal { max-height: 92vh; }
}
/* 구매자 채팅 페이지 — 카톡/슬랙 스타일 (좌측 목록 + 우측 대화)
   index.css 의 indigo 테마 변수 사용 */

.chat-page {
  display: flex;
  height: 100%;
  background: var(--color-surface);
  overflow: hidden;
}

/* ─────────── 좌측 사이드바 ─────────── */
.chat-sidebar {
  width: 320px;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
}

.chat-platform-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.chat-platform-tabs::-webkit-scrollbar { display: none; }
.chat-platform-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
}
.chat-platform-tab:hover { background: var(--color-bg); }
.chat-platform-tab.active { background: var(--color-primary); color: #fff; }
.chat-platform-count { font-size: 10px; opacity: 0.7; }
.chat-platform-unread {
  background: #ef4444; color: #fff;
  border-radius: 999px; padding: 0 5px;
  font-size: 10px; font-weight: 700;
  min-width: 14px; text-align: center;
}
.chat-platform-tab.active .chat-platform-count { opacity: 0.9; }

.chat-search-wrap {
  position: relative;
  padding: 12px;
  border-bottom: 1px solid var(--color-border);
}

.chat-search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.chat-search {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s;
}
.chat-search:focus { border-color: var(--color-primary); }

.chat-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.chat-conv-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.chat-conv-row:hover { background: var(--color-primary-bg); }
.chat-conv-row.selected { background: var(--color-primary-bg); }

/* 전체 읽음 처리 버튼 */
.chat-readall-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 0 12px 8px; padding: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--color-primary); background: var(--color-primary-bg);
  border: 1px solid var(--color-primary-border, #c7d2fe); border-radius: 8px; cursor: pointer;
}
.chat-readall-btn:hover { background: var(--color-primary); color: #fff; }

/* 개별 읽음/안읽음 토글 — 평소 숨김, 행 호버 시 노출 */
.chat-conv-readtoggle {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--color-border); border-radius: 6px; background: #fff;
  color: var(--color-text-secondary); cursor: pointer; opacity: 0; transition: opacity .12s, background .12s, color .12s;
}
.chat-conv-row:hover .chat-conv-readtoggle { opacity: 1; }
.chat-conv-readtoggle:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.chat-conv-row.selected::before {
  content: '';
  position: absolute;
  left: 0;
  width: 3px;
  height: 38px;
  background: var(--color-primary);
  border-radius: 0 2px 2px 0;
}
.chat-conv-row { position: relative; }

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.chat-avatar.lg {
  width: 44px;
  height: 44px;
  font-size: 18px;
}

.chat-conv-body {
  flex: 1;
  min-width: 0;
}

.chat-conv-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.chat-conv-name {
  font-weight: 600;
  color: var(--color-text);
  font-size: var(--font-size-md);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-conv-time {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-conv-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-conv-last {
  flex: 1;
  font-size: var(--font-size-sm);
  color: var(--color-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-out-arrow {
  color: var(--color-primary);
  font-weight: 700;
}

.chat-unread-badge {
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.chat-conv-shop {
  margin-top: 3px;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-conv-country {
  display: inline-block;
  background: var(--color-border);
  color: var(--color-text-dim);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}

/* ─────────── 우측 메인 (대화창) ─────────── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  min-width: 0;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  text-align: center;
  padding: 20px;
}
.chat-empty-title { font-size: var(--font-size-lg); font-weight: 600; margin-top: 12px; color: var(--color-text-dim); }
.chat-empty-desc { font-size: var(--font-size-sm); margin-top: 4px; color: var(--color-text-secondary); }

.chat-empty-sm {
  padding: 20px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.chat-loading {
  padding: 20px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.chat-header-info { flex: 1; min-width: 0; }
.chat-header-name { font-weight: 700; color: var(--color-text); font-size: var(--font-size-lg); }
.chat-header-sub { font-size: var(--font-size-sm); color: var(--color-text-dim); margin-top: 2px; display: flex; align-items: center; gap: 6px; }

/* 메시지 영역 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--color-bg);
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 70%;
}
.chat-msg.in { align-self: flex-start; align-items: flex-start; }
.chat-msg.out { align-self: flex-end; align-items: flex-end; }

.chat-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: var(--shadow-sm);
}
.chat-msg.in .chat-bubble {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-bottom-left-radius: 4px;
}
.chat-msg.out .chat-bubble {
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg-time {
  font-size: 10px;
  color: var(--color-text-muted);
  margin: 3px 8px 0;
}

/* 입력창 */
.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.chat-input {
  flex: 1;
  resize: none;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-bg);
  font-size: 13.5px;
  color: var(--color-text);
  font-family: inherit;
  outline: none;
  max-height: 120px;
  line-height: 1.4;
  transition: border-color 0.15s, background 0.15s;
}
.chat-input:focus { border-color: var(--color-primary); background: var(--color-surface); }
.chat-input::placeholder { color: var(--color-text-muted); }

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.chat-send-btn:hover:not(:disabled) { background: var(--color-primary-hover); }
.chat-send-btn:active:not(:disabled) { transform: scale(0.92); }
.chat-send-btn:disabled {
  background: var(--color-border-strong);
  cursor: not-allowed;
}

/* 스크롤바 */
.chat-conv-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar { width: 8px; }
.chat-conv-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 4px; }
.chat-conv-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* 번역/원본 모달 */
.chat-original-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.55); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.chat-original-modal { background: #fff; border-radius: 12px; padding: 20px 24px; max-width: 480px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.chat-original-title { font-size: 12px; font-weight: 700; color: #94a3b8; text-transform: uppercase; margin-bottom: 6px; }
.chat-original-text { font-size: 14px; padding: 10px 12px; background: #f1f5f9; border-radius: 8px; word-break: break-word; }
.chat-original-divider { font-size: 11px; color: #94a3b8; text-align: center; margin: 10px 0; }
.chat-original-translated { font-size: 14px; padding: 10px 12px; background: #fef3c7; border-radius: 8px; color: #1e293b; word-break: break-word; }
.chat-original-close { margin-top: 14px; width: 100%; padding: 10px; border: none; background: #1e293b; color: #fff; border-radius: 8px; cursor: pointer; font-weight: 600; }

.chat-original-hint { margin-left: 6px; font-size: 10px; opacity: 0.55; cursor: help; }
/* ============================================================
   구매자 채팅 팝업 — 인스타 DM 스타일
   PC: 우하단 floating window (400×560)
   모바일: 화면 하단에서 슬라이드 업 (bottomtab 위)
   ============================================================ */

.bcp-backdrop {
  display: none; /* PC 에서는 backdrop 없음 — 외부 클릭은 document mousedown 으로 감지 */
}

.bcp-platform-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.bcp-platform-tabs::-webkit-scrollbar { display: none; }
.bcp-platform-tab {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 9px; border: none; border-radius: var(--radius-sm);
  background: transparent;
  font-size: 11px; font-weight: 600; color: var(--color-text-secondary);
  cursor: pointer; white-space: nowrap;
}
.bcp-platform-tab:hover { background: var(--color-bg); }
.bcp-platform-tab.active { background: var(--color-primary); color: #fff; }
.bcp-platform-count { font-size: 10px; opacity: 0.7; }

.bcp-window {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 380px;
  height: 540px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  animation: bcp-pop 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes bcp-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── 헤더 ── */
.bcp-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.bcp-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #c9b170);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bcp-title {
  flex: 1;
  min-width: 0;
}

.bcp-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bcp-order {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 2px;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}

.bcp-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bcp-close:hover {
  background: var(--color-primary-bg);
  color: var(--color-text);
}

/* ── 본문 ── */
.bcp-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  background: #fbf9f3;
  display: flex;
  flex-direction: column;
}

/* 메시지 컨테이너 — 자식 chat-msg, chat-bubble 은 ChatPage.css 에서 정의 */
.bcp-messages {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

/* 플레이스홀더는 중앙 정렬 */
.bcp-body > .bcp-placeholder {
  margin: auto;
}

/* 대화 목록 (목록 모드) */
.bcp-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.bcp-conv-list .chat-conv-row { padding: 10px 12px; }
.bcp-conv-list .chat-avatar { width: 34px; height: 34px; font-size: 14px; }

.bcp-placeholder {
  text-align: center;
  color: var(--color-text-secondary);
  padding: 24px;
}

.bcp-placeholder-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.bcp-placeholder-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-dim);
  margin-bottom: 6px;
}

.bcp-placeholder-desc {
  font-size: 12px;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

/* ── 입력창 ── */
.bcp-input-wrap {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--color-border);
  background: #fff;
  flex-shrink: 0;
}

.bcp-input {
  flex: 1;
  min-height: 38px;
  max-height: 96px;
  padding: 9px 14px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  font-size: 13px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.4;
}

.bcp-input:focus { border-color: var(--color-primary); background: var(--color-surface); }
.bcp-input::placeholder { color: var(--color-text-muted); }

.bcp-input:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.bcp-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bcp-send:disabled {
  background: var(--color-border);
  cursor: not-allowed;
}

/* ============================================================
   모바일 — 하단 시트 형태
   ============================================================ */
@media (max-width: 768px) {
  .bcp-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
    animation: bcp-fade 0.2s ease;
  }

  @keyframes bcp-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  .bcp-window {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 80vh;
    border-radius: 16px 16px 0 0;
    z-index: 1000;
    animation: bcp-slide-up 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  @keyframes bcp-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
}
/* ============================================
   App Layout
   PC: 사이드바(왼쪽) + 메인(오른쪽)
   모바일: 상단바 + 본문 + 하단탭
   ============================================ */

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  /* 사이드바가 fixed 로 페이지 위에 떠있으므로 88px 만큼 좌측 비움 (사이드바 기본 너비).
     사이드바 hover 펼침 (240px) 시에는 페이지 좌측 152px 잠깐 가려짐 (에어테이블 스타일).
     이렇게 함으로써 사이드바 width transition 이 페이지 reflow 를 일으키지 않음. */
  padding-left: 88px;
}

.app-content {
  position: relative;
  z-index: 0;
  flex: 1;
  overflow-y: auto;
  /* 행 수 변동으로 세로 스크롤바가 생기거나 사라질 때 본문 가로 너비가
     ~15px 흔들리면서 ResizeObserver가 컬럼 너비를 재계산하는 문제 방지.
     스크롤바 자리를 항상 예약 → 가로 너비 항상 일정. */
  scrollbar-gutter: stable;
  padding: 24px;
  background: var(--color-bg);
}

/* 우하단 채팅 FAB (페이지 무관 항상 표시) */
.chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35), 0 2px 6px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.chat-fab:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.42), 0 3px 8px rgba(0, 0, 0, 0.1);
}
.chat-fab:active { transform: translateY(0) scale(0.96); }

/* 모달/오버레이가 떠 있으면 우측하단 채팅 버튼 숨김 → 모달이 항상 앞으로 (fab z-index 900 이 낮은 모달 위로 뜨던 문제) */
body:has(.bcp-backdrop, .bottom-more-overlay, .chat-original-backdrop, .cmacro-modal-backdrop, .disc-modal-backdrop, .inv-detail-overlay, .inv-modal-overlay, .inv-m-detail-modal, .iz-backdrop, .m-detail-overlay, .m-sheet-backdrop, .order-image-modal, .osd-backdrop, .print-progress-backdrop, .pur-ship-overlay, .pur-m-modal, .pur-m-picker-modal, .recov-backdrop, .set-modal-backdrop, .sm-modal, .split-modal-backdrop, .split-move-menu-backdrop, .split-mq-backdrop, .src-detail-overlay, .src-modal-overlay, .syslog-modal-backdrop) .chat-fab {
  display: none;
}

.chat-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--color-danger);
  color: #fff;
  border: 2px solid var(--color-bg);
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* 모바일 */
@media (max-width: 768px) {
  .chat-fab {
    right: 12px;
    /* 하단탭 위로 띄움 + 액션바 자리도 고려 */
    bottom: calc(var(--bottomtab-height) + env(safe-area-inset-bottom, 0px) + 8px);
    width: 44px;
    height: 44px;
  }
  /* 카드/시트 호버시 작아짐 (덜 가리게) */
  .chat-fab:not(:hover) {
    opacity: 0.85;
  }
  .chat-fab-badge {
    min-width: 18px;
    height: 18px;
    font-size: 9px;
    padding: 0 4px;
  }
}

@media (max-width: 768px) {
  .app-main {
    /* 모바일에선 사이드바 숨김 — padding-left 도 해제 */
    padding-left: 0;
  }
  .app-content {
    position: relative;
    z-index: 0;
    padding: 16px;
    /* bottomtab(safe-area 포함) + 16px 여유 */
    padding-bottom: calc(var(--bottomtab-height) + env(safe-area-inset-bottom, 0px) + 16px);
    /* 모바일에서 자식이 음수 가로 마진(풀스크린 효과) 쓸 때 가로 스크롤 방지 */
    overflow-x: hidden;
  }
  /* 설정 detail 등 풀스크린 페이지 — padding 0 (음수 마진 트릭 대신 명시적 처리, Android 호환) */
  .app-content.flush-content {
    padding: 0;
    padding-bottom: calc(var(--bottomtab-height) + env(safe-area-inset-bottom, 0px));
  }
}

.login-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 380px;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
}

.login-logo-text {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
}

.login-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: 8px;
}

.login-desc {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  margin-bottom: 32px;
}

.login-google-wrap {
  display: flex;
  justify-content: center;
}
.dash {
  max-width: 100%;
}
/* 대시보드일 때만 .app-content 배경 회색 — DashboardPage useEffect 가 dashboard-bg 클래스 토글. */
.app-content.dashboard-bg { background: #f1f3f7; }

/* 긴급 알림 */
.dash-alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.dash-alert { width: fit-content;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px; font-size: 13px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  font-weight: 500;
}

/* 모바일: 알림 풀폭 + 카드 간격 통일 */
@media (max-width: 768px) {
  .dash-alert {
    width: 100%;
    padding: 12px 14px;
  }
}

.dash-alert-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.dash-alert-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.dash-alert-count {
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: var(--font-size-sm);
}

.dash-alert-danger .dash-alert-count {
  background: #fecaca;
  color: #991b1b;
}

.dash-alert-warning .dash-alert-count {
  background: #fde68a;
  color: #78350f;
}

/* 주문 현황 카드 */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.dash-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid #d8dde8;
  border-left: 3px solid var(--color-primary);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  text-align: center;
}

.dash-card:hover {
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.18);
  transform: translateY(-1px);
}

.dash-card-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.dash-card-label svg { color: var(--color-primary); }

.dash-card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -1px;
}

.dash-card-unit {
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-left: 4px;
}

/* 섹션 공통 */
.dash-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid #d8dde8;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
  padding: 20px;
  margin-bottom: 20px;
}

.dash-section-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
}
.dash-section-title svg { color: var(--color-primary); }

/* 환율 */
.dash-rates {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.dash-rate {
  text-align: center;
  padding: 16px 8px;
  border-radius: var(--radius-md);
  background: #f7f8fb;
  border: 1px solid #e2e5ed;
}

.dash-rate-flag {
  width: 28px;
  height: 21px;
  border-radius: 3px;
  margin-bottom: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.dash-rate-code {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.dash-rate-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 2px;
}

.dash-rate-change {
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.dash-rate-up { color: #dc2626; }
.dash-rate-down { color: #2563eb; }
.dash-rate-flat { color: var(--color-text-muted); }

/* 플랫폼 주문 */
.dash-platforms {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.dash-platform {
  padding: 16px;
  border-radius: var(--radius-md);
  background: #f7f8fb;
  border: 1px solid #e2e5ed;
  text-align: center;
  position: relative;
}

.dash-platform-inactive {
  opacity: 0.45;
}

.dash-platform-name {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.dash-platform-count {
  font-size: 24px;
  font-weight: 700;
}

.dash-platform-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  padding: 2px 6px;
  background: #dcdee4;
  border-radius: 4px;
  color: var(--color-text-secondary);
}

/* 채팅 미리보기 */
.dash-chat-placeholder {
  text-align: center;
  padding: 32px;
  color: var(--color-text-secondary);
}

/* 재고 부족 */
/* ── 재고 부족 — 2열 (왼쪽 즉시매입 / 오른쪽 적정미달), 가운데 구분선 ── */
.dash-lowstock-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.dash-lowstock-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
  min-width: 0;             /* 자식 카드가 칸 넘쳐서 줄 틀어지는 것 방지 */
}
.dash-lowstock-col:first-child { padding-left: 0; border-right: 1px solid var(--color-border, #e5e7eb); }
.dash-lowstock-col:last-child { padding-right: 0; }
@media (max-width: 900px) {
  .dash-lowstock-cols { grid-template-columns: 1fr; gap: 18px; }
  .dash-lowstock-col { padding: 0; }
  .dash-lowstock-col:first-child { border-right: none; }
}
.dash-lowstock-empty {
  text-align: center;
  padding: 14px;
  color: var(--color-text-secondary);
  font-size: 12px;
}
.dash-lowstock-more {
  text-align: center;
  padding: 8px;
  font-size: 12px;
  color: var(--color-text-dim);
  cursor: pointer;
  border-radius: 8px;
  background: var(--color-bg, #f9fafb);
}
.dash-lowstock-more:hover { background: var(--color-border, #eee); }

.dash-lowstock-box {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid;
  transition: box-shadow 0.12s;
}
.dash-lowstock-box:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.dash-lowstock-box.danger { background: #fef2f2; border-color: #fecaca; }
.dash-lowstock-box.warning { background: #fffbeb; border-color: #fde68a; }
.dash-lowstock-box-label { font-size: 12px; font-weight: 600; }
.dash-lowstock-box.danger .dash-lowstock-box-label { color: #b91c1c; }
.dash-lowstock-box.warning .dash-lowstock-box-label { color: #92400e; }
.dash-lowstock-box-count { font-size: 26px; font-weight: 800; margin-top: 2px; }
.dash-lowstock-box-count span { font-size: 13px; font-weight: 500; margin-left: 2px; }
.dash-lowstock-box.danger .dash-lowstock-box-count { color: #b91c1c; }
.dash-lowstock-box.warning .dash-lowstock-box-count { color: #92400e; }

.dash-lowstock-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (max-width: 900px) { .dash-lowstock-grid { grid-template-columns: 1fr; } }
.dash-lowstock-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--color-border, #e5e7eb);
  border-left: 3px solid #e5e7eb;
  background: var(--color-surface, #fff);
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s;
}
.dash-lowstock-card:hover { background: var(--color-bg, #f9fafb); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.dash-lowstock-card.danger { border-left-color: #dc2626; }
.dash-lowstock-card.warning { border-left-color: #f59e0b; }
.dash-lowstock-card-info { flex: 1; min-width: 0; }
.dash-lowstock-card-sku { font-size: 11px; color: var(--color-text-secondary); font-family: ui-monospace, monospace; }
.dash-lowstock-card-name { font-size: 13px; font-weight: 500; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-lowstock-card-stock { text-align: right; flex-shrink: 0; }
.dash-lowstock-card-num { font-size: 19px; font-weight: 700; }
.dash-lowstock-card-num span { font-size: 11px; font-weight: 500; margin-left: 1px; }
.dash-lowstock-card-num.danger { color: #c0392b; }
.dash-lowstock-card-num.warning { color: #e67e22; }
.dash-lowstock-card-min { font-size: 10px; color: var(--color-text-secondary); margin-top: 1px; }

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

.dash-stock-table th {
  text-align: left;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
}

.dash-stock-table td {
  padding: 10px 12px;
  font-size: var(--font-size-md);
  border-bottom: 1px solid var(--color-border);
}

.dash-stock-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.dash-stock-dot-red { background: #ef4444; }
.dash-stock-dot-yellow { background: #f59e0b; }

/* 바로가기 */
.dash-shortcuts {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.dash-shortcut {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--color-bg);
  font-size: var(--font-size-md);
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s ease;
  border: 1px solid var(--color-border);
}

.dash-shortcut:hover {
  background: #e4e6ec;
}

@media (max-width: 768px) {
  .dash-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-rates {
    grid-template-columns: repeat(3, 1fr);
  }
  .dash-platforms {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 오늘 요약 — 매출/주문수/판매수량 (3개 한 행). */
.dash-sales-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 0;
  margin-bottom: 24px;
}

/* 오늘 요약 카드 — 인디고는 액센트(상단 라인 + 라벨 chip)로만. 값은 검정. 가운데 정렬. */
.dash-sales-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid #d8dde8;
  border-radius: var(--radius-lg);
  padding: 18px 20px 16px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  text-align: center;
}
.dash-sales-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
}
.dash-sales-card .dash-sales-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin-bottom: 10px;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
}
.dash-sales-card .dash-sales-label svg { flex-shrink: 0; }
.dash-sales-card .dash-sales-value { color: var(--color-text); }

.dash-sales-label {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.dash-sales-value {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.dash-sales-change {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.dash-sales-change.up { color: #10b981; }
.dash-sales-change.down { color: #ef4444; }

.dash-sales-change-label {
  font-size: 12px;
  color: #a0a3b1;
  font-weight: 400;
}

@media (max-width: 768px) {
  .dash-sales-summary {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
  }
  .dash-sales-card { padding: 14px 12px 12px; }
  .dash-sales-value {
    font-size: 17px;
  }
  .dash-sales-card .dash-sales-label {
    font-size: 12px;
    padding: 4px 9px;
    gap: 4px;
  }
  .dash-sales-card .dash-sales-label svg { width: 14px; height: 14px; }
}

/* 작은 폰 (아이폰 미니/SE, 갤럭시 S 일반) — 3개 행 유지하되 간격/폰트만 축소 */
@media (max-width: 480px) {
  .dash-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dash-rates { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .dash-platforms { grid-template-columns: 1fr; }
  .dash-alerts { flex-wrap: wrap; gap: 6px; }
  .dash-sales-summary { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .dash-sales-card { padding: 12px 8px 10px; }
  .dash-sales-value { font-size: 14px; }
  .dash-sales-card .dash-sales-label {
    font-size: 11px;
    padding: 3px 7px;
    gap: 3px;
  }
  .dash-sales-card .dash-sales-label svg { width: 12px; height: 12px; }
}
/* ============================================================
   모바일 공통 컴포넌트 — 머스타드 소프트 테마
   ============================================================ */

.m-page {
  padding: 12px;
  padding-bottom: calc(var(--bottomtab-height, 60px) + 16px);
}

.m-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 4px 4px 8px;
}

.m-page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.m-page-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.m-page-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── 섹션 ── */
.m-section {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px 14px;
}

.m-section-flush {
  padding: 0;
  background: transparent;
  border: none;
}

.m-section-head {
  margin-bottom: 10px;
}

.m-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
}

.m-section-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.m-section-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── 카드 리스트 ── */
.m-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.m-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.m-card-clickable {
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.m-card-clickable:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.m-card-accent-danger {
  border-left: 3px solid #c0392b;
}
.m-card-accent-warning {
  border-left: 3px solid #e67e22;
}
.m-card-accent-success {
  border-left: 3px solid #27ae60;
}

/* ── 행 ── */
.m-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
  font-size: 13px;
  line-height: 1.4;
}

.m-row-label {
  color: var(--color-text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.m-row-value {
  color: var(--color-text);
  font-weight: 500;
  text-align: right;
  flex: 1;
  min-width: 0;
}

.m-mono {
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 12.5px;
}

/* ── 배지 ── */
.m-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.m-badge-default  { background: var(--color-primary-bg); color: var(--color-text-dim); }
.m-badge-primary  { background: #f5e9c8; color: #6b5520; }
.m-badge-success  { background: #d6f0db; color: var(--color-success); }
.m-badge-confirmed{ background: #15803d; color: #fff; font-weight: 700; }
.m-badge-warning  { background: #fde8d0; color: var(--color-warning); }
.m-badge-danger   { background: #fadbd8; color: var(--color-danger); }
.m-badge-info     { background: #d6e3f0; color: var(--color-info); }
.m-badge-muted    { background: var(--color-border); color: var(--color-text-secondary); }

/* ── 시트(모달) ── */
.m-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
  animation: m-fade 0.2s ease;
}

.m-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 32px rgba(0,0,0,0.18);
  animation: m-slide-up 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.m-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.m-sheet-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}

.m-sheet-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.m-sheet-close:hover {
  background: var(--color-primary-bg);
}

.m-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  -webkit-overflow-scrolling: touch;
}

@keyframes m-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes m-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ── 툴바 ── */
.m-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.m-search {
  flex: 1;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
  background: #fff;
  color: var(--color-text);
  outline: none;
}

.m-search:focus {
  border-color: var(--color-primary);
}

.m-toolbar-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--color-text-dim);
}

.m-toolbar-btn:active {
  background: var(--color-primary-bg);
}

/* ── 칩 ── */
.m-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0 10px;
  scrollbar-width: none;
}

.m-chips::-webkit-scrollbar {
  display: none;
}

.m-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 999px;
  font-size: 13px;
  color: var(--color-text-dim);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
}

.m-chip-active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.m-chip-count {
  background: rgba(0,0,0,0.1);
  color: inherit;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
}

.m-chip-active .m-chip-count {
  background: rgba(255,255,255,0.25);
}

/* ── 빈 상태 ── */
.m-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--color-text-secondary);
  font-size: 14px;
  background: var(--color-bg);
  border: 1px dashed var(--color-border);
  border-radius: 12px;
}

/* ── 메인 탭 (언더라인 스타일) — 상태 칩과 시각적 차별화 ── */
.m-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  margin: -4px -2px 12px;
  padding: 0 2px;
}

.m-tab {
  flex: 1;
  padding: 12px 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}

.m-tab-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 700;
}

.m-tab-recovery {
  margin-left: auto;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  align-self: center;
}
.m-tab-recovery:active { background: var(--color-bg); color: var(--color-primary); }

/* ── 선택 액션 바 (하단 고정, BottomTabs 위) ──
   BottomTabs 가 safe-area-inset-bottom 까지 점유하므로 bottom 값에 둘 다 합산. */
.m-bulk-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--bottomtab-height, 60px) + env(safe-area-inset-bottom, 0px));
  background: var(--color-text);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  z-index: 200;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
}

.m-bulk-count {
  font-size: 13px;
  font-weight: 600;
  margin-right: auto;
}

.m-bulk-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.m-bulk-btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.m-bulk-btn:active {
  transform: scale(0.96);
}

/* ── FAB (플로팅 액션 버튼) ── */
.m-fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--bottomtab-height, 60px) + 16px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(160, 136, 64, 0.4);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.m-fab:active {
  transform: scale(0.95);
}

/* ── 상세 편집 모달 (모바일 풀스크린 슬라이드업) ── */
.m-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: stretch;
  animation: m-detail-overlay-in 0.18s ease;
}
@keyframes m-detail-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.m-detail-panel {
  width: 100%;
  max-height: 92vh;
  background: #fff;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
  animation: m-detail-panel-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes m-detail-panel-in {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.m-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.m-detail-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.m-detail-close:hover { background: var(--color-bg); color: var(--color-text); }
.m-detail-close:disabled { opacity: 0.4; cursor: not-allowed; }
.m-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 16px;
}
.m-detail-section {
  margin-bottom: 18px;
}
.m-detail-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}
.m-detail-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 12px;
}
.m-detail-info-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.m-detail-info-grid span {
  font-size: 11px;
  color: var(--color-text-secondary);
}
.m-detail-info-grid strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}
.m-detail-price-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}
.m-detail-price-row:last-child { border-bottom: none; }
.m-detail-price-label {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 44%;
  font-size: 12px;
  color: var(--color-text);
  font-weight: 500;
}
.m-detail-price-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.m-detail-price-input-wrap input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  color: var(--color-text);
  text-align: right;
  -moz-appearance: textfield;
}
.m-detail-price-input-wrap input::-webkit-outer-spin-button,
.m-detail-price-input-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.m-detail-price-input-wrap input:focus {
  outline: none;
  border-color: var(--color-primary);
}
.m-detail-margin {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  flex-shrink: 0;
  min-width: 42px;
  text-align: center;
}
.m-detail-margin.mr-grn { background: #d4f1d8; color: #1b6b2c; }
.m-detail-margin.mr-blu { background: #d8e6f6; color: #1a4a85; }
.m-detail-margin.mr-org { background: #fbe6cf; color: #8a4a0f; }
.m-detail-margin.mr-red { background: #f7d5d5; color: #962020; }
.m-detail-field {
  margin-bottom: 10px;
}
.m-detail-field label {
  display: block;
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}
.m-detail-field input,
.m-detail-field textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  color: var(--color-text);
  font-family: inherit;
  box-sizing: border-box;
  resize: vertical;
}
.m-detail-field input:focus,
.m-detail-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}
.m-detail-link-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  text-decoration: none;
}
.m-detail-link-btn:hover { background: var(--color-primary-bg); color: var(--color-text); }
.m-detail-footer {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  background: #fff;
}
.m-detail-btn {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fff;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.m-detail-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.m-detail-btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.m-detail-btn-primary:disabled { background: var(--color-primary); }
/* OrdersPage.css — 머스타드 소프트 테마 */

.orders-page {
  padding: 20px 24px;
  width: 100%;
}

/* 메인 탭 */
.orders-main-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 20px;
}

.orders-main-tab {
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.orders-main-tab:hover {
  color: var(--color-text-dim);
}

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

/* 주문 가져오기 — 검색창 우측 아이콘 버튼 (쇼피 주문처리 전용) + 커스텀 툴팁 */
.orders-recovery-icon {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  color: var(--color-text-secondary);
  cursor: pointer;
}
.orders-recovery-icon:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-bg); }
/* 호버 시 즉시 뜨는 말풍선 — data-tip 속성 내용 표시 */
.orders-recovery-icon::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-20%);
  background: #1e293b; color: #fff;
  font-size: 12px; font-weight: 500; line-height: 1.4;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .12s ease .05s;
  z-index: 60;
}
.orders-recovery-icon:hover::after { opacity: 1; }

/* 플랫폼 필터 */
.orders-platform-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.orders-platform-pill {
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* 주문 처리 — 플랫폼 4개 큰 서브탭 (Shopee/Lazada/Qoo10/eBay) */
.orders-platform-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0;
}

.orders-platform-subtab {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.orders-platform-subtab:hover {
  color: var(--color-text);
  background: var(--color-primary-bg);
}
.orders-platform-subtab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: var(--color-primary-bg);
}

/* 미지원 플랫폼 안내 영역 */
.orders-platform-placeholder {
  padding: 80px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.orders-platform-placeholder-inner {
  text-align: center;
  max-width: 420px;
  padding: 36px 32px;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
}
.orders-platform-placeholder-title {
  margin-top: 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
}
.orders-platform-placeholder-desc {
  margin-top: 8px;
  font-size: 13px;
  color: var(--color-text-dim);
  line-height: 1.6;
}

.orders-platform-pill:hover {
  border-color: var(--color-primary);
  color: var(--color-text-dim);
}

.orders-platform-pill.active {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
}

/* 상태 필터 */
.orders-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.orders-filter-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text-dim);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.orders-filter-pill:hover {
  border-color: var(--color-primary);
}

.orders-filter-pill.active {
  background: #fff;
  color: var(--color-text);
  font-weight: 700;
  border-color: var(--color-primary);
  box-shadow: var(--pf-ring);
}

.orders-filter-pill.separator {
  border: none;
  background: none;
  color: var(--color-border);
  cursor: default;
  padding: 6px 4px;
}

.orders-filter-pill .pill-count {
  display: inline-block;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  margin-left: 4px;
}

.orders-filter-pill.active .pill-count {
  background: rgba(255, 255, 255, 0.3);
}

.orders-filter-pill:not(.active) .pill-count {
  background: var(--color-primary-bg);
}

/* 사용 빈도별 카운트 색 차등 — 매일 보는 'main' 은 진한 인디고, 'mid' 는 중간, 'ref' 는 옅은 회색 */
.orders-filter-pill.grp-main:not(.active) .pill-count {
  background: var(--color-primary);
  color: #fff;
}
.orders-filter-pill.grp-mid:not(.active) .pill-count {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}
.orders-filter-pill.grp-ref:not(.active) .pill-count {
  background: var(--color-bg);
  color: var(--color-text-muted);
}
/* 'ref' 그룹 자체도 옅게 */
.orders-filter-pill.grp-ref:not(.active) {
  opacity: 0.7;
}

/* 툴바 */
.orders-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* 버튼 묶음 — 검색 입력 오른쪽에서 시작해 toolbar 우측 끝까지. margin-left:auto 로 밀어줌. */
.orders-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.orders-search {
  flex: 0 1 50%;
  max-width: 360px;
  min-width: 200px;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8470' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 10px center no-repeat;
  color: var(--color-text);
}

/* 주문 처리 툴바: 검색창 다음 항목들을 오른쪽으로 밀착 */
.orders-toolbar .orders-unprinted-toggle {
  margin-left: auto;
}

/* 주문 정산 툴바: 검색창 다음 셀렉트/버튼들을 오른쪽으로 밀착 */
.settlement-toolbar .orders-search + .settle-select-wrap {
  margin-left: auto;
}

.orders-search::placeholder {
  color: var(--color-text-secondary);
}

.orders-search:focus {
  border-color: var(--color-primary);
}

.orders-toolbar-btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s;
}

.orders-toolbar-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
}

.orders-toolbar-btn.primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.orders-toolbar-btn.primary:hover {
  background: var(--color-primary-hover);
}

/* 필터 라인 — 좌측 필터 + 우측 인쇄 액션 */
.orders-filterline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: nowrap;
}
.orders-filterline .orders-filters {
  flex: 1;
  margin-bottom: 0;
  flex-wrap: wrap;
}
.orders-print-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* 선택 건수 칩 — 항상 표시 (empty 상태는 옅게) */
.orders-toolbar-selcount {
  padding: 5px 12px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  align-self: center;
  min-width: 80px;
  text-align: center;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.orders-toolbar-selcount.empty {
  background: var(--color-border);
  color: var(--color-text-muted);
}

/* 보조 버튼 — 보더 명확히 + disabled 상태 */
.orders-toolbar-btn.ghost {
  background: #fff;
  border: 1px solid var(--color-border);
  color: var(--color-text-dim);
  padding: 8px 14px;
}
.orders-toolbar-btn.ghost:hover:not(:disabled) {
  background: var(--color-bg);
  border-color: var(--color-text-secondary);
  color: var(--color-text);
}
.orders-toolbar-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 스플릿 버튼 — 주황 톤 (활성 시) */
.orders-toolbar-btn.btn-split:not(:disabled) {
  background: #fff7ed;
  border-color: #fb923c;
  color: #c2410c;
}
.orders-toolbar-btn.btn-split:not(:disabled):hover {
  background: #fb923c;
  color: #fff;
  border-color: #fb923c;
}

/* 인쇄 버튼 — 진한 청록 + 흰 글자 + 볼드 (Arrange 와 다른 톤) */
.orders-toolbar-btn.btn-print {
  background: #0d9488;       /* teal-600 */
  border-color: #0d9488;
  color: #fff;
  font-weight: 700;
  padding: 10px 18px;
  font-size: 13.5px;
}
.orders-toolbar-btn.btn-print:not(:disabled):hover {
  background: #0f766e;       /* teal-700 */
  border-color: #0f766e;
}
.orders-toolbar-btn.btn-print:disabled {
  background: #94a3b8;
  border-color: #94a3b8;
  color: #fff;
  opacity: 1;
}

/* Arrange Shipment — primary 색 + 미리 폭 확보 (숫자 크기 변동 방지) */
.orders-toolbar-btn.btn-arrange {
  min-width: 200px;
  justify-content: center;
}

/* 토글 active 상태 — 전체선택 / 미출력만 선택 버튼이 켜져있을 때 */
.orders-toolbar-btn.active {
  background: #fff;
  border-color: var(--color-primary);
  box-shadow: var(--pf-ring);
  font-weight: 700;
  color: var(--color-text);
  font-weight: 700;
}

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

.orders-unprinted-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.orders-unprinted-toggle input {
  accent-color: var(--color-primary);
}

/* 테이블 공통 — 주문처리는 auto, 정산은 fixed */
.orders-table-wrap {
  /* 흰 카드 + 둥근 모서리 + 보더 (다른 페이지 시트와 통일감).
     테이블 너비가 항상 컨테이너 너비와 일치 → 가로 스크롤 거의 발생 안 함.
     혹시 min-width 합계가 컨테이너보다 클 때만 스크롤. */
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
}

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

.orders-table th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: 10px 12px;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
  font-size: 12px;
  position: relative;
  overflow: hidden;
}

.orders-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  font-size: 13px;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 주문 상태별 행 표시 — 좌측 굵은 보더 (5px). 배경은 흰색 통일. */
.orders-table tr.row-status-ready_to_ship  td:first-child { box-shadow: inset 5px 0 0 #64748b; }     /* 진회색 — 신규 */
.orders-table tr.row-status-ezway          td:first-child { box-shadow: inset 5px 0 0 #f59e0b; }     /* 진노랑 — EZWAY 펜딩(TW) */
.orders-table tr.row-status-processed      td:first-child { box-shadow: inset 5px 0 0 #10b981; }     /* 초록 — 발송준비 */
.orders-table tr.row-status-shipped        td:first-child { box-shadow: inset 5px 0 0 #047857; }     /* 진초록 — 발송완료 */
.orders-table tr.row-status-cancelled      td:first-child { box-shadow: inset 5px 0 0 #ef4444; }     /* 빨강 — 취소 */
.orders-table tr.row-status-cancelled      td { background: #f8f8f8 !important; color: #94a3b8; text-decoration: line-through; }
/* UNPAID 는 주문처리탭에 안 보임 — 그래도 보더 정의 (다른 곳에서 쓸 가능성 대비) */
.orders-table tr.row-status-unpaid         td:first-child { box-shadow: inset 5px 0 0 #f59e0b; }

/* 취소 요청 행 — 발송일 셀 자리에 [승인][거절] 버튼 */
.cancel-actions {
  display: flex;
  gap: 4px;
}
.cancel-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s;
}
.cancel-btn.cancel-accept {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}
.cancel-btn.cancel-accept:hover { background: #059669; }
.cancel-btn.cancel-reject {
  background: #fff;
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.cancel-btn.cancel-reject:hover {
  background: var(--color-bg);
  border-color: var(--color-text-secondary);
}

/* PROCESSED + shipBy 미지정 — 발송일 셀 강조 (지정 필요). 빨강 톤으로 강조. */
.orders-table .cell-ship-need {
  background: #fee2e2 !important;
  position: relative;
  box-shadow: inset 0 0 0 1.5px #ef4444;
}
.orders-table .cell-ship-need::after {
  content: '⚠ 지정 필요';
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 9px;
  font-weight: 800;
  color: #dc2626;
  letter-spacing: -0.3px;
  background: #fff;
  padding: 1px 4px;
  border-radius: 3px;
}

/* 같은 패키지(groupKey) 호버 시 모든 행 동시 강조 — 테마색(인디고) */
.orders-table tr.order-group-hover td {
  background: var(--color-primary-bg) !important;
}
.orders-table tr.row-status-cancelled.order-group-hover td {
  background: #ececec !important;
}

/* 주문번호 셀은 14자 쇼피 주문번호 잘리지 않게 nowrap 보장 */
.orders-table .order-sn-row,
.cell-order-sn {
  white-space: nowrap;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 12.5px;
}

/* 체크박스 칸(첫 열) — 여백 줄여 좁게 (고정 36px 에 맞춤) */
.orders-table th:first-child,
.orders-table td:first-child {
  padding-left: 8px;
  padding-right: 8px;
}

/* 두 테이블 모두 colgroup 기반 고정 레이아웃 — table width 는 인라인 style 로
   colWidths 합계와 동기화. 한 col 너비 변경 시 그 col 만 변경 + table 전체 width 만 변동.
   다른 col 너비는 그대로 유지 — 엑셀처럼 동작. */
.orders-table-fixed,
.settle-table {
  table-layout: fixed;
}

/* 열 너비 드래그 핸들 — th 우측 가장자리 8px 영역.
   idle 시에도 미세하게 보이고, hover/active 시 더 강조. */
.ord-col-resize {
  position: absolute;
  top: 8px;
  bottom: 8px;
  right: 0;
  width: 8px;
  cursor: col-resize;
  user-select: none;
  z-index: 2;
  /* 가운데 세로 라인 1px — idle 에도 살짝 보임 */
  background:
    linear-gradient(to right, transparent 3px, var(--color-border) 3px, var(--color-border) 4px, transparent 4px);
  transition: background 0.12s ease;
}
.ord-col-resize:hover {
  background:
    linear-gradient(to right, rgba(160,136,64,0.15) 0%, rgba(160,136,64,0.15) 100%),
    linear-gradient(to right, transparent 3px, var(--color-primary) 3px, var(--color-primary) 5px, transparent 5px);
  background-blend-mode: normal;
}
.ord-col-resize:active {
  background:
    linear-gradient(to right, rgba(160,136,64,0.25) 0%, rgba(160,136,64,0.25) 100%),
    linear-gradient(to right, transparent 3px, var(--color-primary-hover) 3px, var(--color-primary-hover) 5px, transparent 5px);
}

/* 주문처리 행 — zebra 제거 (전부 흰색). 호버색은 테마색(인디고)으로 통일. */
.order-even td,
.order-odd td { background: #fff; }
.order-row:hover td { background: var(--color-primary-bg) !important; }   /* 인디고-50 */

/* 그룹(같은 주문/패키지) 구분 — order-group-first 위에 보더.
   모든 td 에 적용 (체크박스 셀 포함). 좌측 5px 상태색은 box-shadow inset 으로
   같은 td 안에 그려지므로 border-top 과 별개로 표시됨. */
.orders-table tr.order-group-first td {
  border-top: 2px solid #94a3b8;        /* slate-400 — 중간 톤 회색 (진하지도 옅지도 않게) */
}
.orders-table tr.order-group-child td {
  border-top: 1px dashed #cbd5e1;       /* slate-300 점선 — 자식 행 구분 */
}

.order-sn-row {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;   /* 칸 좁으면 패키지 배지가 아랫줄로 — 안 잘림 */
  gap: 6px;
}

.order-shop-name { font-size: 11px; color: var(--color-text-secondary); }
.order-date { font-size: 12px; }
.order-time { font-size: 11px; color: var(--color-text-secondary); }
.cell-sku { font-family: monospace; font-size: 12px; }
.cell-cost { font-size: 12px; }
.cell-order-sn { font-weight: 600; font-size: 13px; }
.cell-shop { font-size: 12px; color: var(--color-text-dim); }
/* !important 로 강제 — 다른 color 룰 override (PC td + 모바일 div 모두 적용). */
.cell-negative, .cell-negative * { color: #ef4444 !important; }
/* 마진액 셀 — 볼드 + 음수일 때 −기호와 ₩ 사이 살짝 띄움. */
.cell-margin { font-weight: 700; }
.cell-margin .margin-won { margin-left: 2px; }
.cell-muted { color: var(--color-text-muted); font-style: italic; }

/* 상품 이미지 셀 */
.order-product-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-product-img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.order-product-img > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.order-product-img svg { color: var(--color-text-muted); }

/* 호버 시 큰 미리보기 — 셀 overflow:hidden 회피하려면 zoom 자체가 fixed.
   여기선 absolute + z-index 로 처리하고 부모 td 가 overflow:visible 로 보이게 클래스 분리. */
.order-product-img-zoom {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  width: 240px;
  height: 240px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  z-index: 100;
  padding: 6px;
  overflow: hidden;
  pointer-events: none;
}

.order-product-img-zoom img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 호버 시 zoom 보이기. 상품 셀 td 는 일반적으로 overflow:hidden 인데 zoom 이 셀 밖으로 나가야 하므로
   td 가 hover 일 때만 overflow:visible 로. */
.order-product-img-hover:hover .order-product-img-zoom {
  display: block;
}

/* td 가 호버일 때 overflow visible (zoom 잘림 방지) */
.orders-table td:has(.order-product-img-hover:hover) {
  overflow: visible;
}

/* 이미지 셀 클릭 가능 — 이미지 유무와 무관하게 돋보기 커서 표시.
   placeholder(사진 아이콘)도 클릭 가능하므로 "이미지 없음" 모달이 뜸. */
.order-product-img-clickable {
  cursor: zoom-in;
}

/* 상품 이미지 클릭 시 뜨는 풀스크린 모달 */
.order-image-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  cursor: zoom-out;
  padding: 32px;
}

.order-image-modal img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  background: #fff;
  cursor: default;
}

.order-image-modal-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.order-image-modal-close:hover {
  background: #fff;
}

/* "이미지 없음" 안내 박스 (이미지 URL이 비어있는 SKU 클릭 시) */
.order-image-modal-empty {
  background: #fff;
  border-radius: 12px;
  padding: 48px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  color: var(--color-text-dim);
  cursor: default;
}

.order-image-modal-empty svg {
  color: var(--color-text-muted);
}

.order-image-modal-empty-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 4px;
}

.order-image-modal-empty-hint {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* 스플릿 배지 */
.split-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;   /* 줄바꿈될지언정 찌그러지지 않게 */
  gap: 3px;
  background: #fce7f3;
  color: #be185d;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid #fbcfe8;
}
.split-badge-clickable { cursor: pointer; transition: background 0.12s, transform 0.12s; }
.split-badge-clickable:hover { background: #fbcfe8; transform: translateY(-1px); }
.split-badge-clickable:active { transform: translateY(0); }
/* 어레인지 쉽먼트 후 — 잠금 상태. 분홍 색상은 그대로, 클릭만 불가 (hover/cursor 비활성). */
.split-badge-locked { cursor: default; }

/* 재고 dot */
.stock-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.stock-dot.green { background: #10b981; }
.stock-dot.red { background: #ef4444; }
.stock-dot.yellow { background: #f59e0b; }
.stock-dot.gray { background: var(--color-text-muted); }

/* 발송 태그 */
.ship-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.ship-tag.ship-new { background: #dbeafe; color: #1e40af; }
.ship-tag.ship-today { background: #dc2626; color: #fff; }
.ship-tag.ship-tomorrow { background: #7c3aed; color: #fff; }
.ship-tag.ship-dayafter { background: #eab308; color: #fff; }
.ship-tag.ship-ezway { background: #fee2e2; color: #991b1b; }
.ship-tag.ship-ezway-done { background: #ccfbf1; color: #0f766e; }
.ship-tag.ship-cancel { background: #d4d4d4; color: #525252; }

/* 출력완료 배지 */
.printed-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #d1fae5;
  color: #065f46;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
}

/* 구매자 이름 링크 */
.buyer-name-link {
  color: var(--color-primary);
  cursor: pointer;
  font-weight: 500;
}

.buyer-name-link:hover {
  text-decoration: underline;
}

/* 벌크 액션 바 */
.orders-bulk-bar {
  position: sticky;
  bottom: 0;
  background: var(--color-text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  z-index: 10;
}

.orders-bulk-bar button {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}

.orders-bulk-bar button:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Arrange Shipment 버튼 — 강조 */
.orders-bulk-bar .bulk-arrange-btn {
  background: #fff !important;
  color: var(--color-primary) !important;
  border-color: #fff !important;
  font-weight: 700 !important;
}
.orders-bulk-bar .bulk-arrange-btn:hover:not(:disabled) {
  background: var(--color-primary-bg) !important;
}
.orders-bulk-bar .bulk-arrange-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

.bulk-ship-wrap { position: relative; }

.bulk-ship-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 6px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  z-index: 100;
}

.bulk-ship-menu button {
  display: block;
  width: 100%;
  padding: 10px 20px;
  border: none;
  background: #fff;
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.bulk-ship-menu button:hover { background: var(--color-primary-bg); }

/* 정산 요약 카드 */
.settlement-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.settlement-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 14px 18px;
}

.settlement-card-label {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.settlement-card-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}

/* 정산 툴바 */
.settlement-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.settle-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.settle-select {
  appearance: none;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--color-text);
  background: #fff;
  cursor: pointer;
  outline: none;
  min-width: 120px;
}

.settle-select:focus { border-color: var(--color-primary); }

.settle-select-icon {
  position: absolute;
  right: 10px;
  color: var(--color-text-secondary);
  pointer-events: none;
}

.settle-date-input {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #fff;
  color: var(--color-text);
}

.settle-date-input:focus { border-color: var(--color-primary); }
.settle-date-sep { color: var(--color-text-secondary); font-size: 13px; }

/* 정산 테이블 행 */
.settle-row td {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
}

.settle-row:nth-child(even) td { background: var(--color-row-zebra); }
.settle-row:hover td { background: var(--color-row-hover); }

.settle-item-row { font-size: 13px; }
.settle-item-qty { color: var(--color-text-secondary); }

.settle-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--color-text-secondary);
  font-size: 14px;
}

/* 주문상태 배지 */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* 단계별 고유 색상 — 모든 상태 식별 가능하게 분리:
   배송준비중(노랑) → 배송중(파랑) → 배송도착(청록) → 구매확정(짙은 초록 + 머스타드 보더)
   배송도착 ↔ 구매확정 명확히 구분 (이전엔 비슷한 초록 톤). */
/* 행 라벨 색깔 — 같은 탭이어도 status 마다 다르게 (한눈에 구분) */
.status-badge.st-pending   { background: #fef3c7; color: #92400e; }            /* 인증대기중 - 옅은 노랑 */
.status-badge.st-new       { background: #fee2e2; color: #991b1b; font-weight: 700; }  /* 신규주문 - 빨강 (사용자 작업 필요) */
.status-badge.st-process   { background: #fef3c7; color: #92400e; }            /* 배송준비중 - 노랑 (어레인지 완료) */
.status-badge.st-shipped   { background: #dbeafe; color: #1e40af; }            /* 배송중 - 파랑 */
.status-badge.st-delivered { background: #ccfbf1; color: #0f766e; }            /* 배송도착 - 청록 */
.status-badge.st-completed { background: #15803d; color: #fff; font-weight: 700; }     /* 구매확정 - 진녹 */
.status-badge.st-cancel    { background: #fee2e2; color: #991b1b; }            /* 취소/취소진행/반품 - 빨강 */

/* 정산상태 배지 */
.settle-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.settle-badge.none { background: var(--color-primary-bg); color: var(--color-text-secondary); }
.settle-badge.pending { background: #fee2e2; color: #9a3412; }
.settle-badge.estimated { background: #fef3c7; color: #7a6a28; }
.settle-badge.confirmed { background: #d1fae5; color: #065f46; }

/* 반품 주문 — 행 전체 주황 강조 (고정폭 칸에 안 잘리게 행 단위로). */
.settle-row-return td { background: #fff7ed !important; }
.settle-row-return .cell-order-sn { overflow: visible !important; }  /* 배지 안 잘리게 */

/* 반품(손실) 배지 — 구매확정에 묻히지 않게 상태 옆에 강조 표시 */
.return-badge {
  display: block;
  width: fit-content;
  margin-left: 0;
  margin-top: 3px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fdba74;
  white-space: nowrap;
}

/* 마진율 바 */
.margin-bar-wrap {
  position: relative;
  width: 90px;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
}

.margin-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s;
}

.margin-bar-text {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 11px;
  font-weight: 700;
}

/* 텍스트는 fill 위에 그려지므로 fill 보다 대비 강한 색 사용. */
.margin-bar-wrap.margin-excellent { background: #d1fae5; }
.margin-bar-wrap.margin-excellent .margin-bar-fill { background: #10b981; }
.margin-bar-wrap.margin-excellent .margin-bar-text { color: #fff; text-shadow: 0 0 2px rgba(0,0,0,0.2); }

.margin-bar-wrap.margin-normal { background: #e5e5e5; }
.margin-bar-wrap.margin-normal .margin-bar-fill { background: #a3a3a3; }
.margin-bar-wrap.margin-normal .margin-bar-text { color: #1f2937; }

.margin-bar-wrap.margin-low { background: #fecaca; }
.margin-bar-wrap.margin-low .margin-bar-fill { background: #fca5a5; }
.margin-bar-wrap.margin-low .margin-bar-text { color: #7f1d1d; }

.margin-bar-wrap.margin-critical { background: #fecaca; }
.margin-bar-wrap.margin-critical .margin-bar-fill { background: #dc2626; }
.margin-bar-wrap.margin-critical .margin-bar-text { color: #fff; text-shadow: 0 0 2px rgba(0,0,0,0.2); }

/* 채팅 팝업 */
.chat-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 320px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--color-border);
  z-index: 1000;
  overflow: hidden;
}

.chat-popup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.chat-popup-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: 2px;
  display: flex;
}

.chat-popup-close:hover { color: var(--color-text); }

.chat-popup-body {
  padding: 40px 16px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 14px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 발송일 인라인 select — ship-tag 와 색감 유사하게.
   각 옵션별 클래스로 배경색 차등 적용. */
.ship-select {
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: var(--color-primary-bg);
  color: var(--color-text-dim);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3e%3cpath fill='%238a8470' d='M1 3l4 4 4-4z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 20px;
}

.ship-select:hover {
  border-color: var(--color-primary);
}

.ship-select-new      { background-color: var(--color-primary-bg); color: var(--color-text-dim); }
.ship-select-today    { background-color: #d6f0db; color: var(--color-success); }
.ship-select-tomorrow { background-color: #d6e3f0; color: var(--color-info); }
.ship-select-dayafter { background-color: #fde8d0; color: var(--color-warning); }

/* 반응형 */
@media (max-width: 768px) {
  .orders-page { padding: 12px 12px; }
  .settlement-cards { grid-template-columns: 1fr 1fr 1fr; }
  .orders-toolbar, .settlement-toolbar { flex-direction: column; align-items: stretch; }
  .orders-search { min-width: 100%; }
  .settle-select { width: 100%; }
  /* 주문 테이블 — 컬럼 많음. 가로 스크롤로 보존. */
  .orders-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .orders-table { min-width: 900px; }
  .settle-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .settle-table { min-width: 1000px; }
  .chat-popup { width: calc(100% - 24px); right: 12px; bottom: 70px; }
  /* 상단 필터 탭(신규/오늘/내일/...) — 가로 스크롤 */
  .orders-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .orders-tab { flex-shrink: 0; }
}

/* 작은 폰 */
@media (max-width: 480px) {
  .orders-page { padding: 10px; }
  .settlement-cards { grid-template-columns: 1fr; gap: 8px; }
  .orders-toolbar-btn, .orders-toolbar-btn.primary { padding: 6px 10px; font-size: 12px; }
}

/* 송장 생성 진행 모달 */
.print-progress-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6);
  display: flex; align-items: center; justify-content: center; z-index: 3000;
}
.print-progress-modal {
  background: #fff; border-radius: 12px; padding: 28px 32px;
  min-width: 320px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.print-progress-title { font-size: 18px; font-weight: 700; color: #1e293b; margin-bottom: 16px; }
.print-progress-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.pp-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #94a3b8;
  padding: 6px 10px; border-radius: 6px;
}
.pp-step.done { color: #1e293b; background: #f1f5f9; }
.pp-icon { font-size: 16px; }
.print-progress-hint { font-size: 11px; color: #94a3b8; text-align: center; }
.print-progress-label-big { font-size: 15px; font-weight: 600; color: #1e293b; text-align: center; margin-bottom: 14px; }
.print-progress-bar { width: 100%; height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.print-progress-bar-fill { height: 100%; background: var(--color-primary); border-radius: 4px; transition: width 0.3s ease; }

/* ── momo 정산금 입력 (수술 4번, 2026-07-15) ── */
.momo-settle-btn {
  margin-left: 6px; padding: 2px 8px; font-size: 11px; font-weight: 700;
  border: 1px solid var(--color-primary-border)/*≈#c7d2fe*/; border-radius: 6px; background: var(--color-primary-bg)/*≈#eef2ff*/; color: var(--color-primary-hover)/*≈#4338ca*/;
  cursor: pointer; white-space: nowrap;
}
.momo-settle-btn:hover { background: var(--color-primary-bg)/*≈#e0e7ff*/; }
.momo-settle-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.momo-settle-modal {
  width: 100%; max-width: 460px; background: #fff; border-radius: 14px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25); overflow: hidden;
}
.momo-settle-head { padding: 16px 20px; font-size: 15px; font-weight: 700; border-bottom: 1px solid #e2e8f0; }
.momo-settle-body { padding: 16px 20px; }
.momo-settle-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 8px; }
.momo-settle-row span:first-child { color: #64748b; flex-shrink: 0; }
.momo-settle-row span:last-child { text-align: right; }
.momo-settle-input-label { display: block; margin-top: 12px; }
.momo-settle-input-label > span { display: block; font-size: 12px; font-weight: 600; color: #64748b; margin-bottom: 6px; }
.momo-settle-input-label input {
  width: 100%; height: 44px; font-size: 18px; font-weight: 700; text-align: right;
  border: 1.5px solid var(--color-primary-border)/*≈#c7d2fe*/; border-radius: 10px; padding: 0 12px; box-sizing: border-box;
}
.momo-settle-input-label input:focus { outline: none; border-color: var(--color-primary)/*≈#6366f1*/; }
.momo-settle-hint { margin-top: 10px; font-size: 12px; color: #92400e; background: #fffbeb; border-radius: 8px; padding: 8px 10px; line-height: 1.5; }
.momo-settle-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid #e2e8f0; }
.momo-settle-cancel { padding: 9px 16px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; cursor: pointer; font-size: 13px; }
.momo-settle-save { padding: 9px 16px; border: none; border-radius: 8px; background: var(--color-primary)/*≈#4f46e5*/; color: #fff; font-weight: 700; cursor: pointer; font-size: 13px; }
.momo-settle-save:disabled, .momo-settle-cancel:disabled { opacity: 0.5; cursor: not-allowed; }
.momo-settle-btn.momo-unship-btn { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.momo-settle-btn.momo-unship-btn:hover { background: #ffedd5; }
/* momo 정산 셀 — 금액+입력 / 발송취소 세로 스택 (좁은 컬럼에서 버튼 잘림 방지) */
.momo-settle-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; white-space: normal; }
.momo-settle-cell .momo-unship-btn { margin-left: 0; }
/* momo 정산 예정 힌트 — 배송도착 +11일(감상기간 종료) */
.momo-settle-eta { font-size: 11px; }
/* momo 정산 일괄 입력 모달 */
.momo-settle-bulk { max-width: 640px; }
.momo-settle-paste { width: 100%; resize: none; height: 96px; border: 1.5px dashed #cbd5e1; border-radius: 10px; padding: 10px 12px; font-size: 13px; font-family: inherit; background: #f8fafc; box-sizing: border-box; }
.momo-settle-paste:focus { outline: none; border-color: var(--color-primary)/*≈#6366f1*/; background: #fff; }
.momo-settle-preview { margin-top: 10px; min-height: 72px; max-height: 220px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.7; }

/* ── ERP 공용 다이얼로그 (AppDialog.jsx) — 시스템 alert/confirm 대체, 전 플랫폼 공용 ── */
.app-dialog-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.app-dialog { background: #fff; border-radius: 14px; box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3); width: 100%; max-width: 420px; overflow: hidden; }
.app-dialog-wide { max-width: 560px; }
.app-dialog-head { display: flex; align-items: center; gap: 8px; padding: 16px 20px 0; font-size: 15px; font-weight: 700; color: #1e293b; }
.app-dialog-ico.ico-info { color: var(--color-primary)/*≈#6366f1*/; }
.app-dialog-ico.ico-warn { color: #d97706; }
.app-dialog-ico.ico-danger { color: #dc2626; }
.app-dialog-body { padding: 12px 20px 4px; max-height: 60vh; overflow-y: auto; }
.app-dialog-message { font-size: 13.5px; line-height: 1.7; color: #334155; white-space: pre-line; word-break: break-all; }
.app-dialog-block-intro { font-size: 13.5px; color: #334155; margin-bottom: 12px; }
.app-dialog-problems { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: prob; }
.app-dialog-problem { counter-increment: prob; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 10px 12px 10px 38px; position: relative; }
.app-dialog-problem::before { content: counter(prob); position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; border-radius: 50%; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.app-dialog-problem-what { font-size: 13px; font-weight: 600; color: #7f1d1d; line-height: 1.5; word-break: break-all; }
.app-dialog-problem-fix { font-size: 12.5px; color: #475569; margin-top: 3px; line-height: 1.5; }
.app-dialog-problem-fix::before { content: '\2192  '; color: #dc2626; font-weight: 700; }
.app-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 16px; }
.app-dialog-btn { border: 1.5px solid #e2e8f0; background: #fff; color: #475569; border-radius: 9px; padding: 8px 18px; font-size: 13px; font-weight: 600; cursor: pointer; }
.app-dialog-btn:hover { background: #f8fafc; }
.app-dialog-btn.primary { border-color: var(--color-primary); background: var(--color-primary); color: #fff; }
.app-dialog-btn.primary:hover { filter: brightness(1.06); }
.app-dialog-btn.primary.danger { border-color: #dc2626; background: #dc2626; }
.app-dialog-input { width: 100%; margin-top: 10px; border: 1.5px solid #e2e8f0; border-radius: 9px; padding: 9px 12px; font-size: 13.5px; box-sizing: border-box; }
.app-dialog-input:focus { outline: none; border-color: var(--color-primary); }

/* ── 플랫폼 테마 (형 확정 7/17): 플랫폼 탭 = 다른 사이트 느낌. 시트(orders-table-wrap 내부)는 절대 불변.
   새 플랫폼 추가 = 여기에 .pf-큐텐 변수 세트 한 벌만 등록 ── */
.orders-page { position: relative; transition: background-color 0.25s ease; }
.orders-page.pf-shopee, .mo-pfwrap.pf-shopee { --pf: #ee4d2d; --pf-deep: #c93a1c; --pf-bg: #fdf3ef; }
.orders-page.pf-momo,   .mo-pfwrap.pf-momo   { --pf: #d9006c; --pf-deep: #ad0056; --pf-bg: #fdf0f6; }
.orders-page.pf-shopee, .orders-page.pf-momo { z-index: 0; min-height: calc(100vh - 120px); }
/* 배경은 본문 영역(app-content) 자체에 — 스크롤바 예약칸·여백까지 완전히 채움 (v3) */
/* z-index:0 = 스태킹 컨텍스트 생성 → 워터마크(z:-1)가 시트·본문 '아래층'에만 깔림 (시트 위로 안 비침) */

/* 브랜드 헤더 밴드 — 셀러센터풍. key 로 전환 시 페이드 */
.pf-band { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; padding: 13px 18px; border-radius: 12px;
  background: linear-gradient(100deg, var(--pf) 0%, var(--pf-deep) 100%); color: #fff; animation: pfFade 0.12s ease; position: relative; z-index: 1; }
.pf-band-logo { background: #fff; border-radius: 8px; padding: 3px 4px; display: inline-flex; align-items: center; }
.pf-band-title { font-size: 15.5px; font-weight: 800; letter-spacing: 0.2px; }
@keyframes pfFade { from { opacity: 0.4; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* 로고 워터마크 — 시트 뒤 배경 (클릭 안 잡힘) */
.pf-watermark { position: absolute; right: 28px; bottom: 16px; opacity: 0.045; pointer-events: none; z-index: -1; }

/* 플랫폼 탭 = 소싱 페이지 src-mp-btn 문법으로 통일 (알약 카드: 로고+이름, 2px 테두리, 활성=브랜드 테두리+연배경) */
.orders-platform-subtabs, .orders-platform-filters { display: flex; gap: 8px; padding: 8px 0; margin-bottom: 10px; border-bottom: none; flex-wrap: wrap; }
.orders-platform-subtab, .orders-platform-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border: 2px solid var(--color-border); background: #fff; border-radius: 10px;
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--color-text-secondary);
  transition: all 0.12s ease; font-family: inherit; }
.orders-platform-subtab:hover, .orders-platform-pill:hover { border-color: var(--color-text-secondary); color: var(--color-text); background: #fff; }
.orders-platform-subtab.active, .orders-platform-pill.active {
  font-weight: 700; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  border-color: var(--pf, var(--color-primary)); color: var(--pf, var(--color-primary));
  background: color-mix(in srgb, var(--pf, var(--color-primary)) 8%, white); }

/* 시트 밖 주요 버튼 = 브랜드색 (인쇄·발송완료/Arrange·필터 primary) — 시트 내부 셀은 불변 */
.orders-page.pf-shopee .orders-toolbar-btn.btn-print:not(:disabled), .orders-page.pf-momo .orders-toolbar-btn.btn-print:not(:disabled) {
  background: var(--pf); border-color: var(--pf); }
.orders-page.pf-shopee .orders-toolbar-btn.btn-print:not(:disabled):hover, .orders-page.pf-momo .orders-toolbar-btn.btn-print:not(:disabled):hover {
  background: var(--pf-deep); border-color: var(--pf-deep); }
.orders-page.pf-shopee .orders-toolbar-btn.primary:not(:disabled), .orders-page.pf-momo .orders-toolbar-btn.primary:not(:disabled) {
  background: var(--pf); border-color: var(--pf); }
.orders-page.pf-shopee .orders-toolbar-btn.primary:not(:disabled):hover, .orders-page.pf-momo .orders-toolbar-btn.primary:not(:disabled):hover {
  background: var(--pf-deep); border-color: var(--pf-deep); }

/* 활성 상태칩 = 연한 브랜드 + 브랜드 테두리·글자 (숫자 알약이 잘 보이게 — 형 지시 7/17) */
.orders-page.pf-shopee .orders-filter-pill.active, .orders-page.pf-momo .orders-filter-pill.active {
  background: #fff; border-color: var(--pf); color: var(--color-text); box-shadow: var(--pf-ring); }

/* ── 모바일 테마 ── */
.mo-pfwrap { background: transparent; padding: 0; margin: 0; }
.pf-band-m { padding: 10px 14px; margin: 0 0 10px; }
.pf-band-m .pf-band-title { font-size: 13.5px; }
.mo-pfwrap.pf-shopee .mo-pt.active, .mo-pfwrap.pf-momo .mo-pt.active { background: #fff; border-color: var(--pf); color: var(--color-text); box-shadow: var(--pf-ring); }
.mo-pfwrap.pf-shopee .m-chip-active, .mo-pfwrap.pf-momo .m-chip-active { background: #fff; border-color: var(--pf); color: var(--color-text); box-shadow: var(--pf-ring); }
.mo-pfwrap.pf-shopee .mo-ab-arrange:not(:disabled), .mo-pfwrap.pf-momo .mo-ab-arrange:not(:disabled) { background: var(--pf); border-color: var(--pf); }


/* ── 테마 v2 (형 지시 7/17): body[data-pf] = 모달·포털 포함 전역 전파 ── */
body[data-pf="shopee"] { --pf: #ee4d2d; --pf-deep: #c93a1c; --pf-bg: #fdf3ef; --pf-dim: #f4b3a0; }
body[data-pf="momo"]   { --pf: #d9006c; --pf-deep: #ad0056; --pf-bg: #fdf0f6; --pf-dim: #efa4c8; }

/* (1) 비활성 버튼도 연한 브랜드 톤 — 활성/비활성 명암차는 유지 */
body[data-pf] .orders-toolbar-btn.btn-print:disabled,
body[data-pf] .orders-toolbar-btn.primary:disabled,
body[data-pf] .mo-ab-arrange:disabled {
  background: var(--pf-dim); border-color: var(--pf-dim); color: #fff; opacity: 1; }

/* (4) 칩 카운트 — main=진브랜드+흰숫자 / mid=연브랜드+브랜드숫자 / ref=회색 유지(참고용 옅음 컨셉) / 활성=진브랜드 */
body[data-pf] .orders-filter-pill.grp-main:not(.active) .pill-count { background: var(--pf); color: #fff; }
body[data-pf] .orders-filter-pill.grp-mid:not(.active) .pill-count { background: color-mix(in srgb, var(--pf) 12%, white); color: var(--pf); }
body[data-pf] .orders-filter-pill.active .pill-count { background: var(--pf); color: #fff; }
body[data-pf] .m-chip:not(.m-chip-active) .m-chip-count { background: color-mix(in srgb, var(--pf) 14%, white); color: var(--pf); }
body[data-pf] .m-chip-active .m-chip-count { background: var(--pf); color: #fff; }
/* 검색창 — index.css 전역 '검색 인풋 인디고' 규칙(!important, (0,3,1))을 브랜드로 제압.
   선택자 무게 (0,4,1) + 파일 후순위 = 확실히 이김. 틴트·돋보기 아이콘·플레이스홀더까지 브랜드 */
body[data-pf] input[placeholder*="검색"]:not(.pur-cell-input):not(.inv-comp-search-input) {
  border-color: color-mix(in srgb, var(--pf) 35%, white) !important;
  background-color: #fff !important; } /* 틴트 배경 위에서 흰 카드로 뜨게 (묻힘 방지 — 형 7/17) */
body[data-pf] input[placeholder*="검색"]:not(.pur-cell-input):not(.inv-comp-search-input)::placeholder {
  color: #64748b; } /* 진회색 — 브랜드 연색은 안 보임(형 7/17). 입력값(검정)과 구분 위해 검정은 안 씀 */
body[data-pf] input[placeholder*="검색"]:not(.pur-cell-input):not(.inv-comp-search-input):focus {
  border-color: var(--pf) !important; background-color: #fff !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pf) 15%, transparent) !important; }
body[data-pf="shopee"] input[placeholder*="검색"]:not(.pur-cell-input):not(.inv-comp-search-input) {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ee4d2d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>"); }
body[data-pf="momo"] input[placeholder*="검색"]:not(.pur-cell-input):not(.inv-comp-search-input) {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23d9006c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>"); }

/* (5) 모달 테마 — 포털/루트 모달 포함. 위험(danger) 빨간 버튼은 신호색이라 불변 */
body[data-pf] .app-dialog-btn.primary:not(.danger) { background: var(--pf); border-color: var(--pf); }
body[data-pf] .app-dialog-ico.ico-info { color: var(--pf); }
body[data-pf] .app-dialog-input:focus { border-color: var(--pf); }
body[data-pf] .print-progress-bar-fill { background: var(--pf); }
body[data-pf] .momo-settle-save { background: var(--pf); }
body[data-pf] .momo-settle-paste:focus { border-color: var(--pf); }
body[data-pf] .momo-btn-primary { background: var(--pf); border-color: var(--pf); }
body[data-pf] .momo-btn-primary:hover:not(:disabled) { background: var(--pf-deep); border-color: var(--pf-deep); }

/* (3) 모바일 꽉 채우기 — app-content 여백(16px)+하단탭까지 침범 */



/* ── 테마 v3 (형 7개 지시 7/17) ── */
/* (4) 배경 = 본문 영역 전체 (스크롤바 예약칸 포함 진짜 꽉 참) */
body[data-pf] .app-content { background: var(--pf-bg); transition: background-color 0.25s ease; }
body[data-pf] .m-page { background: var(--pf-bg); }
body[data-pf] .src-page { background: transparent; } /* 소싱 몸통 회백색이 테마 배경 덮던 것 해제 */

/* (1) 정산 '전체' 중립 밴드 — 플랫폼 밴드와 같은 자리·높이 = 전환 시 위치 불변 */
.pf-band-neutral { background: linear-gradient(100deg, #6366f1 0%, #4f46e5 100%); }

/* (7) 시트 행 호버만 브랜드 옅은 톤 (형 승인 — 데이터 의미색 아님). 취소행 호버는 회색 유지 */
body[data-pf] .orders-table tr.order-group-hover td { background: var(--pf-hover) !important; }
body[data-pf] .orders-table tr.row-status-cancelled.order-group-hover td { background: #ececec !important; }


/* ── 테마 v5 (형 6개 지시 7/17) ── */
/* (1) 선택 카운트 배지 — 활성 시 브랜드색 (선택없음 회색 유지) */
body[data-pf] .orders-toolbar-selcount:not(.empty) { background: var(--pf); }
/* (3) 샵관리·대량등록 내부 인디고 = ERP 기본색 변수 → 브랜드로 플립 (의미색은 변수 안 써서 안전) */
body[data-pf] .disc-page, body[data-pf] .br-page {
  --color-primary: var(--pf);
  --color-primary-hover: var(--pf-deep);
  --color-primary-bg: color-mix(in srgb, var(--pf) 10%, white);
  --color-primary-border: color-mix(in srgb, var(--pf) 30%, white);
}


/* ── 테마 v6 (형 7개 지시 7/17 — 전 페이지 색 통일 규격) ──
   규격표: 메인탭 활성 = --pf-deep(어둡고 진하게) / primary 버튼 base = --pf, hover = --pf-deep /
   필터칩·세그 활성 = 연브랜드(--color-primary-bg 플립)+브랜드 글자 / 시트 호버·교차 = 브랜드 옅은 톤 /
   그래프 기본색 = var(--color-primary) 사용(플립으로 자동 브랜드). 인디고 하드코딩 금지 — 변수만. */
body[data-pf] .orders-main-tab.active, body[data-pf] .disc-tab.active,
body[data-pf] .ana-main-tab.active, body[data-pf] .m-tab-active {
  color: var(--pf-deep); border-bottom-color: var(--pf-deep); }
/* 변수 플립 확장 — 소싱·매출분석·모바일 페이지 (주문 시트 불변 위해 .orders-page 자체는 플립 안 함) */
body[data-pf] .src-page, body[data-pf] .ana-page, body[data-pf] .m-page, body[data-pf] .rs-page {
  --color-primary: var(--pf);
  --color-primary-hover: var(--pf-deep);
  --color-primary-bg: color-mix(in srgb, var(--pf) 10%, white);
  --color-primary-border: color-mix(in srgb, var(--pf) 30%, white);
}


/* ── 테마 v7 (형 7/17): 호버 농도 사다리 + 주문관리 시트밖 브랜드 + 토글/실행 규격 + 카드 테두리 ──
   농도 사다리: 페이지 배경 5~6% < 활성 배경 10% < 호버 15%(--pf-hover). 
   토글(상태 표시) = 연배경+브랜드 테두리+브랜드 글자 / 실행 버튼(인쇄·발송완료·일괄적용) = 채움 유지.
   카드 테두리 = 1px, 얇지만 진하게(--pf-card-border). */
:root { --pf-hover: color-mix(in srgb, var(--color-primary) 15%, white);
        --pf-card-border: color-mix(in srgb, var(--color-primary) 40%, #94a3b8); }
body[data-pf] { --pf-hover: color-mix(in srgb, var(--pf) 15%, white);
                --pf-card-border: color-mix(in srgb, var(--pf) 40%, #94a3b8); }

/* 주문관리 시트 밖 요소 — 페이지 플립 제외(시트 보호)라 개별 브랜드 지정 */
body[data-pf] .orders-page .orders-toolbar-btn:hover:not(:disabled):not(.primary):not(.btn-print) {
  background: #fff; border-color: var(--pf); }
body[data-pf] .orders-page .orders-toolbar-btn.active {
  background: #fff; border-color: var(--pf); color: var(--color-text); box-shadow: var(--pf-ring); }
body[data-pf] .orders-page .orders-filter-pill:hover { border-color: var(--pf); }
body[data-pf] .orders-page .orders-main-tab:hover { color: var(--pf-deep); }


/* ── 테마 v10 (형 7/18): 앱 뼈대(사이드바·상단바·하단탭바)도 플랫폼 세계에 합류 ──
   전부 --color-primary 계열 변수 기반이라 플립만 — E 로고·활성 메뉴·아이콘·호버·배경 일괄. */
body[data-pf] .sidebar, body[data-pf] .topbar, body[data-pf] .bottom-tabs, body[data-pf] .bottom-more-sheet {
  --color-primary: var(--pf);
  --color-primary-hover: var(--pf-deep);
  --color-primary-bg: color-mix(in srgb, var(--pf) 8%, white);
  --color-primary-border: color-mix(in srgb, var(--pf) 30%, white);
  --color-primary-light: color-mix(in srgb, var(--pf) 14%, white);
}
/* 🛑 transition 을 여기서 덮으면 사이드바 원래 열림 애니메이션(width 0.15s)이 죽음 (7/18 사고) — 원래 전환 + 배경만 추가 */
body[data-pf] .sidebar { transition: width 0.15s ease, background-color 0.25s ease, border-color 0.25s ease; }

/* 사이드바 = 본문(5~6%)보다 한 단계 진한 14% + 브랜드 경계선 — 레일/본문 구분 (형 7/18) */
body[data-pf] .sidebar {
  background: color-mix(in srgb, var(--pf) 14%, white);
  border-right: 1px solid color-mix(in srgb, var(--pf) 30%, white);
}
/* 주문 발송일 드롭다운 — PC/모바일 공용 커스텀 컴포넌트 */

.osd-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

/* 시스템 상태 배지 (변경 불가) */
.osd-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.osd-badge.osd-lg {
  font-size: 12px;
  padding: 5px 12px;
}

/* 트리거 버튼 — 현재 발송일 표시 */
.osd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 4px 8px 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
  /* 터치 영역 보장 — 모바일에서도 충분 */
  min-height: 28px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.osd-trigger:hover:not(:disabled) {
  filter: brightness(0.82);
  border-color: var(--color-text);                    /* 검정 톤 보더 — 어떤 배경에서도 명확 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.osd-trigger:active:not(:disabled) {
  filter: brightness(0.75);
  transform: translateY(0);
}

.osd-lg .osd-trigger {
  font-size: 13px;
  padding: 6px 10px 6px 12px;
  min-height: 34px;
  border-radius: 14px;
}

.osd-trigger-label {
  line-height: 1;
}

.osd-arrow {
  opacity: 0.65;
  margin-left: 2px;
}

/* 드롭다운 메뉴 */
.osd-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 1000;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  min-width: 140px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: osd-pop 0.14s ease-out;
}

.osd-lg .osd-menu {
  min-width: 170px;
  padding: 6px;
  border-radius: 12px;
}

@keyframes osd-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 옵션 — 메뉴 안 텍스트는 흰 배경이라 어두운 색으로 고정 (trigger 색과 별개).
   옵션 색상 구분은 좌측 m-item-dot 으로 표현. */
.osd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  width: 100%;
  color: var(--color-text);
  -webkit-tap-highlight-color: transparent;
  /* 터치 영역 보장 */
  min-height: 36px;
}

.osd-item-label {
  flex: 1;
}

.osd-lg .osd-item {
  padding: 11px 12px;
  font-size: 14px;
  min-height: 44px;
  border-radius: 8px;
}

/* 호버 색 — 진한 회색 (active 색과 명확히 구분) */
.osd-item:hover,
.osd-item:focus-visible {
  background: #e2e8f0;        /* slate-200 */
  outline: none;
}

/* 현재 선택된 옵션 — 진한 인디고 + 흰 글자 (호버색과 완전히 다른 톤) */
.osd-item-active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
}
/* active 위에 마우스 호버 → 더 진한 인디고 */
.osd-item-active:hover,
.osd-item-active:focus-visible {
  background: var(--color-primary-hover);
  color: #fff;
}

.osd-item-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
.osd-item-active .osd-item-dot { border-color: rgba(255, 255, 255, 0.5); }

.osd-check {
  margin-left: auto;
  font-weight: 700;
  color: var(--color-primary);
}
.osd-item-active .osd-check { color: #fff; }

/* 메뉴 열림 backdrop — 뒷 시트 hover 차단용 (투명) */
.osd-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: transparent;
}
/* 스플릿 모달 — 패키지 세로 카드 + 드롭다운 이동 + 미니 수량 다이얼로그 */

.split-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.split-modal {
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.split-modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.split-modal-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
}
.split-modal-sub {
  margin-top: 4px;
  font-size: var(--font-size-sm);
  color: var(--color-text-dim);
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}
.split-modal-header > button {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.split-modal-header > button:hover { background: var(--color-bg); color: var(--color-text); }

.split-modal-block {
  margin: 16px 18px 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.split-modal-body {
  padding: 14px 18px 16px;
  overflow-y: auto;
  flex: 1;
}

.split-help {
  font-size: var(--font-size-sm);
  color: var(--color-text-dim);
  padding: 10px 12px;
  background: var(--color-bg);
  border-left: 3px solid var(--color-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 14px;
  line-height: 1.5;
}

/* ── 패키지 카드 ──
   overflow 는 두지 않음 — 자식 드롭다운(.split-move-menu) 이 카드 밖으로 떠야 함.
   카드 모서리는 헤더/바디 각각 border-radius 로 처리.
   메뉴 열린 카드만 z-index 올려서 다음 카드 위로 띄움. */
.split-pkg-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}
.split-pkg-card.menu-open {
  z-index: 100;
}
.split-pkg-card.empty {
  border-style: dashed;
  background: var(--color-bg);
}

.split-pkg-card-head {
  padding: 8px 12px;
  background: var(--color-primary-bg);
  border-bottom: 1px solid var(--color-border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.split-pkg-card.empty .split-pkg-card-head {
  background: var(--color-bg);
  border-bottom: 1px dashed var(--color-border);
}
.split-pkg-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
}
.split-pkg-card-count {
  margin-left: 4px;
  padding: 1px 8px;
  background: var(--color-surface);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-dim);
}
.split-pkg-card-remove {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-danger);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.12s;
}
.split-pkg-card-remove:hover {
  background: var(--color-danger-bg);
  border-color: var(--color-danger);
}

.split-pkg-card-body {
  padding: 6px 10px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.split-pkg-empty-hint {
  padding: 16px;
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* ── 상품 라인 ── */
.split-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--color-border);
}
.split-line:last-child { border-bottom: 0; }

.split-line-thumb {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  flex-shrink: 0;
  overflow: hidden;
}
.split-line-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.split-line-info {
  flex: 1;
  min-width: 0;
}
.split-line-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.split-line-sub {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--color-text-muted);
}
.split-line-sku {
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}
.split-line-qty {
  padding: 1px 8px;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border-radius: 10px;
  font-weight: 700;
  font-size: 11px;
}

/* 이동 버튼 + 드롭다운 */
.split-line-actions {
  position: relative;
  flex-shrink: 0;
}

.split-move-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.split-move-btn:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-bg); }
.split-move-btn.open { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.split-move-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2050;
}

.split-move-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 4px;
  z-index: 2060;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.split-move-menu button {
  text-align: left;
  padding: 7px 10px;
  border: none;
  background: transparent;
  color: var(--color-text);
  font-size: 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.1s;
}
.split-move-menu button:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

/* + 새 패키지 추가 */
.split-add-pkg-btn {
  width: 100%;
  padding: 12px;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.12s;
}
.split-add-pkg-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-bg);
}
.split-add-pkg-count {
  margin-left: 8px;
  padding: 1px 8px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.split-warn,
.split-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}
.split-warn {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning);
  color: var(--color-warning);
}
.split-error {
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
}

.split-modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--color-bg);
  flex-shrink: 0;
}
.split-footer-info {
  font-size: var(--font-size-sm);
  color: var(--color-text-dim);
  font-weight: 500;
}
.split-footer-actions {
  display: flex;
  gap: 8px;
}

.split-btn-cancel,
.split-btn-submit {
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  transition: all 0.12s;
}
.split-btn-cancel:hover { background: var(--color-bg); }
.split-btn-submit {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.split-btn-submit:hover:not(:disabled) { background: var(--color-primary-hover); }
.split-btn-submit:disabled {
  background: var(--color-border-strong);
  border-color: var(--color-border-strong);
  color: #fff;
  cursor: not-allowed;
}

/* ── 수량 이동 미니 다이얼로그 ── */
.split-mq-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2100;
  padding: 16px;
}

.split-mq {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.split-mq-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--color-text);
}
.split-mq-head > span { display: flex; align-items: center; gap: 6px; }
.split-mq-head button {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.split-mq-head button:hover { background: var(--color-bg); }

.split-mq-body {
  padding: 14px;
}
.split-mq-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.split-mq-qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.split-mq-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}
.split-mq-max {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 600;
}
.split-mq-stepper {
  display: flex;
  align-items: center;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.split-mq-stepper button {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--color-text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.split-mq-stepper button:hover:not(:disabled) { background: var(--color-primary-bg); color: var(--color-primary); }
.split-mq-stepper button:disabled { color: var(--color-border-strong); cursor: not-allowed; }
.split-mq-stepper input {
  width: 50px;
  height: 28px;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}
.split-mq-stepper input::-webkit-inner-spin-button,
.split-mq-stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.split-mq-footer {
  padding: 10px 14px 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 모바일 — iOS Safari 의 100vh 는 주소창 포함이라 footer 가 화면 밖으로 잘림.
   dvh(dynamic viewport height) 로 실제 가용 영역만 사용. footer sticky 보강. */
@media (max-width: 768px) {
  .split-modal-backdrop {
    padding: 0;
    align-items: stretch;
    height: 100vh;
    height: 100dvh;
  }
  .split-modal {
    max-height: 100dvh;
    height: 100dvh;
    max-width: 100%;
    border-radius: 0;
  }
  .split-modal-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    position: sticky;
    bottom: 0;
    z-index: 5;
  }
  .split-move-menu { right: -4px; }
}
/* 이미지 확대 모달 — 검정 backdrop + 중앙 이미지 + 우상단 X */

.iz-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  /* 앱 내 모든 모달(품절관리 9000, 번들딜 1000 등) 위에 뜨도록 최상단 */
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}

.iz-backdrop > img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: default;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  border-radius: 6px;
}

.iz-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.iz-close:hover { background: rgba(255, 255, 255, 0.3); }

.iz-empty {
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: default;
}

/* 모바일 */
@media (max-width: 768px) {
  .iz-backdrop { padding: 12px; }
  .iz-close {
    top: 12px;
    right: 12px;
    /* safe-area top 고려 */
    margin-top: env(safe-area-inset-top, 0);
  }
}
/* momo 수동주문 탭 — PC·모바일 공용. 인디고 테마 통일. */
/* PC: 쇼피 주문처리탭과 같은 문서 흐름(각 요소의 자체 margin 만 사용) — flex gap 이 간격을 벌려 시트 위치가 어긋났던 병 수정 */
.momo-tab { display: block; padding: 0 0 24px; }
.momo-tab.momo-mobile { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 24px; }

.momo-card { background: #fff; border: 1px solid var(--color-border, #e2e8f0); border-radius: 12px; padding: 16px 18px; }
.momo-card-title { font-size: 15px; font-weight: 700; color: var(--color-text, #1e293b); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.momo-count { font-size: 12px; font-weight: 600; color: var(--color-text-secondary, #64748b); }
.momo-entry-btn { margin-left: auto; }

.momo-form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.momo-field { display: flex; flex-direction: column; gap: 4px; }
.momo-field span { font-size: 11px; font-weight: 600; color: var(--color-text-secondary, #64748b); }
.momo-field input { height: 34px; padding: 0 10px; border: 1px solid var(--color-border, #e2e8f0); border-radius: 8px; font-size: 13px; }
.momo-field input:focus { outline: none; border-color: var(--color-primary, #4338ca); }

.momo-items-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--color-text-secondary, #64748b); margin-bottom: 6px; }
.momo-item-row { display: flex; gap: 8px; margin-bottom: 6px; align-items: center; }
.momo-item-row input { height: 34px; padding: 0 10px; border: 1px solid var(--color-border, #e2e8f0); border-radius: 8px; font-size: 13px; }
.momo-item-row input:focus { outline: none; border-color: var(--color-primary, #4338ca); }
.momo-sku { flex: 2; min-width: 0; }
.momo-qty { width: 80px; }
.momo-price { width: 130px; }
.momo-del { flex-shrink: 0; }

.momo-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.momo-toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--color-text-secondary, #64748b); cursor: pointer; }
.momo-toggle input { accent-color: var(--color-primary, #4338ca); }

.momo-btn-primary { padding: 9px 20px; background: var(--color-primary, #4338ca); color: #fff; border: none; border-radius: 9px; font-size: 13px; font-weight: 700; cursor: pointer; }
.momo-btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.momo-btn-ghost { padding: 5px 10px; background: #fff; color: var(--color-text-secondary, #64748b); border: 1px solid var(--color-border, #e2e8f0); border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; }
.momo-btn-ghost:hover { border-color: var(--color-primary-border)/*≈#c7d2fe*/; color: var(--color-primary, #4338ca); }

.momo-empty { padding: 28px 12px; text-align: center; color: var(--color-text-secondary, #94a3b8); font-size: 13px; }
.momo-list { display: flex; flex-direction: column; gap: 8px; }
.momo-order { border: 1px solid var(--color-border, #e2e8f0); border-radius: 10px; padding: 10px 12px; }
.momo-order.momo-cancelled { opacity: .55; }
.momo-order-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.momo-order-sn { font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700; color: var(--color-text, #1e293b); }
.momo-order-date { font-size: 12px; color: var(--color-text-secondary, #64748b); }
.momo-order-buyer { font-size: 12px; color: var(--color-text-secondary, #64748b); }
.momo-order-amounts { margin-left: auto; font-size: 13px; font-weight: 700; }
.momo-order-amounts em { font-style: normal; font-size: 11px; font-weight: 500; color: var(--color-text-secondary, #64748b); margin-left: 6px; }
.momo-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--color-primary-bg)/*≈#eef2ff*/; color: var(--color-primary-hover)/*≈#4338ca*/; }
.momo-badge-cancelled { background: #fee2e2; color: #b91c1c; }
.momo-badge-shipped, .momo-badge-completed { background: #dcfce7; color: #15803d; }
.momo-cancel-btn { color: #b91c1c; }
.momo-order-items { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.momo-chip { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: #f1f5f9; color: var(--color-text, #334155); font-family: ui-monospace, monospace; }
.momo-chip em { font-style: normal; color: var(--color-text-secondary, #64748b); }
.momo-chip-track { background: #fef3c7; color: #92400e; }


/* ── 수동입력 모달 (createPortal → body 직속) ── */
.momo-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.momo-modal {
  width: 100%; max-width: 920px; max-height: 94vh;
  background: #fff; border-radius: 14px;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}
.momo-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--color-border, #e2e8f0);
  flex-shrink: 0;
}
.momo-modal-title { font-size: 16px; font-weight: 700; color: var(--color-text, #1e293b); }
.momo-modal-x {
  width: 30px; height: 30px; border: none; background: none; cursor: pointer;
  font-size: 15px; color: var(--color-text-secondary, #64748b); border-radius: 8px;
}
.momo-modal-x:hover { background: #f1f5f9; }
.momo-modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; min-height: 0; }
.momo-modal-body .momo-field input { height: 40px; font-size: 14px; }
.momo-modal-body .momo-item-row input { height: 40px; font-size: 14px; }
.momo-modal-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-top: 1px solid var(--color-border, #e2e8f0);
  flex-shrink: 0; flex-wrap: wrap;
}
.momo-modal-foot-btns { display: flex; gap: 8px; margin-left: auto; }
.momo-modal-foot .momo-btn-primary { padding: 11px 24px; font-size: 14px; }
.momo-modal-foot .momo-btn-ghost { padding: 10px 18px; font-size: 13px; }


/* 상태 칩 (쇼피 주문처리탭과 같은 개념) */
.momo-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.momo-chip-btn {
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--color-border, #e2e8f0); background: #fff; color: var(--color-text-secondary, #64748b);
}
.momo-chip-btn em { font-style: normal; font-weight: 700; margin-left: 2px; }
.momo-chip-btn:hover { border-color: var(--color-primary-border)/*≈#c7d2fe*/; color: var(--color-primary, #4338ca); }
.momo-chip-btn.active { background: var(--color-primary, #4338ca); border-color: var(--color-primary, #4338ca); color: #fff; }

/* 주문 카드 액션 줄 */
.momo-order-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--color-border, #e2e8f0); }
.momo-actions-label { font-size: 11px; font-weight: 700; color: var(--color-text-secondary, #64748b); }
.momo-ship-btn { padding: 6px 14px; font-size: 12px; }
.momo-order-actions .momo-cancel-btn { margin-left: auto; }
.momo-badge-day { background: #fef3c7; color: #92400e; }
.momo-badge-ready_to_ship { background: #fee2e2; color: #b91c1c; }
.momo-badge-processed { background: var(--color-primary-bg)/*≈#eef2ff*/; color: var(--color-primary-hover)/*≈#4338ca*/; }

/* 모달 안내 힌트 */
.momo-modal-hint { margin-top: 10px; font-size: 12px; line-height: 1.6; color: var(--color-text-secondary, #64748b); background: #f8fafc; border-radius: 8px; padding: 10px 12px; }


/* momo 시트 보조 (본체는 쇼피 .orders-table 클래스 재사용) */
.momo-td-mono { font-family: ui-monospace, monospace; font-size: 12px; }
.momo-td-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.momo-row-cancelled td { opacity: .5; }
.momo-sheet .momo-empty { white-space: normal; }

/* 모바일 — 칩 가로 스크롤 + 선택 툴바 (쇼피 모바일 문법) */
.momo-filters-scroll { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; -webkit-overflow-scrolling: touch; }
.momo-filters-scroll .orders-filter-pill { flex-shrink: 0; }
.momo-mo-toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.momo-mo-selcount { font-size: 12px; color: var(--color-text-secondary, #64748b); }
.momo-mo-toolbar .momo-entry-btn { margin-left: auto; }

/* 모바일 — 폼 2열, 품목행 유지 */
.momo-mobile .momo-form-grid { grid-template-columns: 1fr 1fr; }
@media (max-width: 768px) {
  .momo-form-grid { grid-template-columns: 1fr 1fr; }
  .momo-price { width: 110px; }
  .momo-order-amounts { margin-left: 0; width: 100%; }
}

/* 🛑 모달 모바일 오버라이드 — 반드시 파일 맨 끝(모든 base 뒤): 풀시트 100dvh + 하단 고정 푸터 */
@media (max-width: 768px) {
  .momo-modal-overlay { padding: 0; align-items: stretch; }
  .momo-modal { max-width: none; max-height: none; height: 100dvh; border-radius: 0; }
  .momo-modal-body { -webkit-overflow-scrolling: touch; }
  .momo-modal-body .momo-form-grid { grid-template-columns: 1fr 1fr; }
  .momo-modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .momo-modal input[type=date] { appearance: none; -webkit-appearance: none; min-width: 0; width: 100%; }
}

/* ── 수술 패키지 (2026-07-15): 모달 크기업 + 복붙 파서 + 발송완료(택배사+송장) 모달 ── */
/* 크기업: 폭 넓히고 내부 스크롤 없이 다 보이게 (내용이 화면보다 클 때만 스크롤 폴백) */
.momo-modal-xl { max-width: 1040px; }
.momo-modal-sm { max-width: 480px; }
.momo-paste-field { display: block; margin-bottom: 10px; }
.momo-paste-field > span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--color-text-secondary, #64748b); }
.momo-paste-box {
  width: 100%; resize: vertical; min-height: 64px;
  border: 1.5px dashed var(--color-border, #cbd5e1); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; font-family: inherit;
  background: #f8fafc; box-sizing: border-box;
}
.momo-paste-box:focus { outline: none; border-color: var(--color-primary)/*≈#6366f1*/; background: #fff; }
.momo-paste-result {
  margin: 8px 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5;
}
.momo-paste-result.ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.momo-paste-result.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.momo-paste-warn { font-size: 12px; opacity: 0.9; }
.momo-revenue-preview {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: #f1f5f9; font-size: 14px; color: var(--color-text, #1e293b);
}
.momo-revenue-preview strong { color: var(--color-primary)/*≈#4f46e5*/; }
.momo-deadline-note { color: #b45309; font-weight: 600; }
.momo-deadline { font-size: 11px; color: #b45309; margin-top: 2px; }
.momo-modal-body .momo-field select {
  height: 40px; font-size: 14px; width: 100%;
  border: 1px solid var(--color-border, #cbd5e1); border-radius: 8px; padding: 0 10px;
  background: #fff; box-sizing: border-box;
}

/* ── 출력 도장 (중복발송 방지 — momo 라벨은 셀러센터 출력, 여기선 마킹만. API 오면 진짜 출력 버튼 승격) ── */
.momo-print-badge {
  padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
  border: 1px dashed #cbd5e1; border-radius: 8px; background: #fff; color: #64748b;
}
.momo-print-badge:hover { border-color: var(--color-primary)/*≈#6366f1*/; color: var(--color-primary-hover)/*≈#4338ca*/; }
.momo-print-badge.on {
  border: 1px solid #a7f3d0; background: #ecfdf5; color: #047857; border-style: solid;
}
.momo-print-badge:disabled { opacity: 0.5; cursor: not-allowed; }
/* 삭제 버튼 — 위험 동작 시각 구분 (🛑 API 연동 시 버튼째 제거) */
.orders-toolbar-btn.momo-del-btn { color: #b91c1c; border-color: #fecaca; }
.orders-toolbar-btn.momo-del-btn:hover:not(:disabled) { background: #fef2f2; }

/* '출력' 도장 = 쇼피 printed-badge 모양 그대로, 클릭 토글만 추가 (API 오면 진짜 출력 버튼 승격) */
.momo-print-toggle { cursor: pointer; user-select: none; }
.momo-print-toggle.off { opacity: 0.45; border-style: dashed; }
.momo-print-toggle.off:hover { opacity: 0.8; }

/* 쇼피와 줄 높이 픽셀 일치: 칩줄 우측 CTA = 쇼피 '인쇄' 크기, 툴바 = 쇼피 툴바 최소높이 */
.momo-entry-cta { padding: 10px 18px; font-size: 13.5px; font-weight: 700; }
.momo-tab .orders-toolbar { min-height: 36px; }

/* EZWAY 대기 (쇼피와 동일 개념 — 대만 관세청 실명인증 위임) */
.momo-ezway-btn {
  padding: 5px 12px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
  border: 1px solid #fcd34d; border-radius: 8px; background: #fffbeb; color: #b45309;
}
.momo-ezway-btn:hover:not(:disabled) { background: #fef3c7; }
.momo-ezway-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.momo-badge-pending { background: #fef3c7; color: #b45309; }
.momo-modal-foot-toggles { display: flex; flex-direction: column; gap: 6px; }

/* ── 수동입력 모달 고정 크기 (형 지시 7/15: 입력 중 크기 안 흔들리게 미리 공간 확보) ── */
.momo-modal-xl { max-width: 1040px; height: min(880px, 92vh); }
.momo-modal-xl .momo-modal-body { overflow-y: auto; }
.momo-paste-result.idle { background: #f8fafc; color: #94a3b8; border: 1px dashed #e2e8f0; }
.momo-paste-result { min-height: 44px; box-sizing: border-box; }
.momo-items-scroll { height: 210px; overflow-y: auto; border: 1px solid var(--color-border, #e2e8f0); border-radius: 10px; padding: 8px; box-sizing: border-box; }
.momo-paste-box { height: 76px; resize: none; }
/* 인증 일괄확인 모드 미리보기 (형 확정 7/20) */
.momo-ship-preview { border: 1px solid var(--color-border); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.momo-ship-line { color: var(--color-text-secondary); }
.momo-ship-line.ok { color: var(--color-text); font-weight: 600; }
.momo-ship-line.warn { color: var(--color-danger); font-weight: 600; } /* 반품 확정 = 돈 걸린 처리 경고색 */
.momo-ship-nos { font-family: monospace; font-size: 12px; color: var(--color-text); word-break: break-all; }
/* 모바일 주문관리 — 새 버전 */

/* 플랫폼 서브탭 (가로 스크롤) */
.mo-platform-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px 0 8px;
  scrollbar-width: none;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 8px;
}
.mo-platform-tabs::-webkit-scrollbar { display: none; }
.mo-pt {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: all 0.12s;
}
.mo-pt:hover { color: var(--color-text); }
.mo-pt.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.mo-platform-placeholder {
  margin-top: 40px;
  padding: 40px 16px;
  text-align: center;
  border: 1px dashed var(--color-border-strong);
  border-radius: 12px;
  background: var(--color-bg);
}
.mo-platform-placeholder > svg {
  margin: 0 auto 12px;
  display: block;
}
.mo-pp-title { font-size: 16px; font-weight: 700; color: var(--color-text); margin-bottom: 4px; }
.mo-pp-desc { font-size: 12px; color: var(--color-text-dim); }

/* 카드 — 좌측 상태 색 보더는 inline style 로 */
.m-card.selected {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}
.m-card.cancelled {
  opacity: 0.65;
}
.m-card.cancelled .m-mono,
.m-card.cancelled .mo-line {
  text-decoration: line-through;
}

/* 배지 */
.mo-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 800;
  vertical-align: 1px;
}
.mo-badge-ezway { background: #fef3c7; color: #92400e; }
.mo-badge-cancelreq { background: #fee2e2; color: #b91c1c; }

/* 카드 안 취소 요청 액션 */
.mo-cancel-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.mo-cb {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
}
.mo-cb-accept { background: #10b981; color: #fff; border-color: #10b981; }
.mo-cb-reject { background: #fff; color: var(--color-text); border-color: var(--color-border-strong); }

/* SKU 라인 */
.mo-line {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}
.mo-line.short {
  background: #fef2f2;
  border-color: #fecaca;
}
.mo-thumb {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
}
.mo-thumb img { width: 100%; height: 100%; object-fit: cover; }

.mo-stock {
  font-size: 11px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.mo-stock.short { color: #c0392b; font-weight: 700; }
.mo-stock.zero { color: var(--color-text-secondary); }
.mo-stock.ok { color: var(--color-success); }

/* 하단 sticky 액션바 */
.mo-action-bar {
  position: fixed;
  left: 8px; right: 8px;
  bottom: calc(var(--bottomtab-height) + env(safe-area-inset-bottom, 0px) + 8px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--color-text);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 800;
}
.mo-ab-count {
  flex-shrink: 0;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.mo-ab-btn {
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.mo-ab-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.15); }
.mo-ab-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mo-ab-split {
  background: #fb923c !important;
  border-color: #fb923c !important;
  color: #fff !important;
  font-weight: 700;
}
.mo-ab-arrange {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  color: #fff !important;
  font-weight: 700;
  flex: 1;
  justify-content: center;
}

.mo-ab-ship-wrap {
  position: relative;
}
.mo-ab-ship-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: #fff;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  min-width: 80px;
  z-index: 850;
}
.mo-ab-ship-menu button {
  background: transparent;
  border: none;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  border-radius: 6px;
}
.mo-ab-ship-menu button:hover { background: var(--color-primary-bg); color: var(--color-primary); }

/* 액션바 떴을 때 본문 하단 여백 확보 — 카드 마지막 행이 액션바에 가리지 않게 */
.app-content:has(.mo-action-bar) {
  padding-bottom: calc(var(--bottomtab-height) + env(safe-area-inset-bottom, 0px) + 80px) !important;
}

/* 필터 칩 색 차등 — MobileChips 가 그리는 .m-chip 에 group 클래스 가능하면 */
.m-chip[data-group="main"]:not(.active) { font-weight: 700; }
.m-chip[data-group="ref"]:not(.active) { opacity: 0.6; }

/* 이미지 확대 */
.mo-zoom {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.mo-zoom img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.mo-zoom-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* ─── 정산탭 모바일 ─── */
.mo-settle-selects {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.mo-settle-select {
  flex: 1;
  min-width: 0;
  padding: 7px 8px;
  font-size: 12px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
}

/* 주문처리탭 전체선택/전체해제 토글 바 */
.mo-selectall-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 8px;
}
.mo-selectall-btn {
  padding: 6px 14px;
  border: 1px solid var(--color-primary-border)/*≈#c7d2fe*/;
  background: var(--color-primary-bg)/*≈#eef2ff*/;
  color: var(--color-primary-hover)/*≈#4338ca*/;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.mo-selectall-btn:active { background: var(--color-primary-bg)/*≈#e0e7ff*/; }
.mo-selectall-count { font-size: 12px; color: var(--color-primary)/*≈#6366f1*/; font-weight: 600; }

.mo-settle-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}
.mo-settle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mo-settle-sn {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
}
.mo-settle-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--color-text-secondary);
}
.mo-settle-shop {
  font-weight: 600;
  color: var(--color-text);
}

.mo-settle-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  background: var(--color-bg);
  border-radius: 6px;
  border: 1px solid var(--color-border);
}
.mo-settle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.mo-settle-item-name {
  flex: 1;
  min-width: 0;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mo-settle-item-qty {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 11px;
}

.mo-settle-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mo-settle-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  background: var(--color-bg);
  border-radius: 6px;
  border: 1px solid var(--color-border);
  min-width: 0;
}
.mo-settle-stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-dim);
  letter-spacing: 0.3px;
}
.mo-settle-stat-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mo-settle-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px dashed var(--color-border);
}
.mo-settle-weight {
  font-size: 11px;
  color: var(--color-text-secondary);
  font-weight: 600;
}
.recov-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.recov-modal { width: 100%; max-width: 540px; max-height: 88vh; background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); display: flex; flex-direction: column; }
.recov-head { padding: 14px 18px; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; justify-content: space-between; }
.recov-head h3 { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 6px; color: var(--color-text); }
.recov-head button { background: transparent; border: none; cursor: pointer; color: var(--color-text-secondary); width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.recov-head button:hover { background: var(--color-bg); }

.recov-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.recov-hint { font-size: 12px; color: var(--color-text-dim); background: var(--color-bg); border-left: 3px solid var(--color-primary); padding: 10px 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; line-height: 1.6; }
.recov-hint strong { color: var(--color-text); }

.recov-section { display: flex; flex-direction: column; gap: 6px; }
.recov-label { font-size: 12px; font-weight: 600; color: var(--color-text-dim); }
.recov-textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); font-family: 'SFMono-Regular', Menlo, monospace; font-size: 12px; color: var(--color-text); resize: vertical; outline: none; }
.recov-textarea:focus { border-color: var(--color-primary); }
.recov-meta { font-size: 11px; color: var(--color-text-muted); text-align: right; }

.recov-actions { display: flex; gap: 8px; }
.recov-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); }
.recov-btn:hover:not(:disabled) { background: var(--color-bg); }
.recov-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.recov-btn.primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.recov-btn.primary:hover:not(:disabled) { background: var(--color-primary-hover); }
.recov-btn.ghost { background: var(--color-bg); }

.recov-result { display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--color-bg); border-radius: var(--radius-sm); border: 1px solid var(--color-border); }
.recov-result-row { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.recov-result-row.ok { color: #047857; }
.recov-result-row.info { color: #1e40af; }
.recov-result-row.err { color: #b91c1c; flex-direction: column; align-items: flex-start; }
.recov-result-row strong { font-weight: 700; }

.recov-fail-list { margin: 6px 0 0 22px; padding: 0; font-size: 12px; }
.recov-fail-list li { margin: 2px 0; }
.recov-fail-list code { background: #fee2e2; padding: 1px 4px; border-radius: 3px; font-size: 11px; }

.recov-details { font-size: 12px; }
.recov-details summary { cursor: pointer; color: var(--color-text-dim); padding: 4px 0; }
.recov-details ul { margin: 6px 0 0 22px; padding: 0; }
.recov-details code { background: var(--color-surface); padding: 1px 4px; border-radius: 3px; font-size: 11px; }

@media (max-width: 768px) {
  .recov-actions { flex-direction: column; }
}
/* 페이지 전체 스크롤 방식 — .inv-page 는 콘텐츠 따라 늘어남.
   실제 스크롤은 .app-content 가 담당 (전체 페이지 우측 스크롤바). */
.inv-page {
  padding: 20px 24px;
  width: 100%;
  box-sizing: border-box;
}

/* 탭 */
.inv-main-tabs { display: flex; gap: 0; border-bottom: 2px solid #e8e9ef; margin-bottom: 16px; }
.inv-main-tab { padding: 10px 24px; font-size: 15px; font-weight: 600; color: var(--color-text-secondary); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.inv-main-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* 요약 카드 */
.inv-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.inv-summary-card { background: #fff; border-radius: 12px; padding: 20px 22px; border: 1px solid #eee; }
.inv-summary-label { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.inv-summary-value { font-size: 26px; font-weight: 700; color: var(--color-text); }
.inv-summary-card.alert .inv-summary-value { color: #dc2626; }
.inv-summary-card.warning .inv-summary-value { color: #d97706; }

/* 툴바 */
.inv-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.inv-search-box { flex: 0 1 320px; }
.inv-search-box input {
  width: 100%; padding: 8px 14px; border: 1px solid var(--color-border); border-radius: 10px;
  font-size: 13px; background: #fff; outline: none; box-sizing: border-box; height: 36px;
}
.inv-search-box input:focus { border-color: var(--color-primary); }

/* 필터 드롭다운 — 검색창 옆 */
.inv-filter-select {
  height: 36px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3e%3cpath fill='%238a8470' d='M1 3l4 4 4-4z'/%3e%3c/svg%3e") no-repeat right 10px center;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  flex-shrink: 0;
  min-width: 140px;
}
.inv-filter-select:focus { border-color: var(--color-primary); }

/* 매입 등록 버튼 */
.inv-purchase-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 16px; height: 36px; background: var(--color-primary); color: #fff; border: none; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.inv-purchase-btn:hover { background: var(--color-primary-hover); }

/* 테이블 — 페이지 전체 스크롤 사용 (.app-content 가 scroll container).
   wrap 은 스크롤 X, overflow 제거. 가로 스크롤만 보존. */
.inv-table-wrap {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--color-border-strong);
  overflow-x: auto;
}
.inv-table { width: 100%; border-collapse: collapse; }
/* thead 를 표 상단에 고정. 스크롤시에도 컬럼명 항상 보임. */
.inv-table thead th {
  position: sticky; top: 0; z-index: 3;
  text-align: left; padding: 9px 14px; font-size: 12px;
  color: var(--color-text-secondary); font-weight: 600;
  background: #fafbfd;
  border-bottom: 1px solid var(--color-border-strong);
  white-space: nowrap;
}
.inv-table td { padding: 8px 14px; font-size: 13px; color: var(--color-text); border-bottom: 1px solid var(--color-border); vertical-align: middle; }

/* 체크박스 컬럼 */
.inv-th-check, .inv-td-check { width: 32px; min-width: 32px; max-width: 32px; padding: 8px 4px 8px 12px !important; text-align: center; }
.inv-th-check input, .inv-td-check input { margin: 0; cursor: pointer; }

/* 새 컬럼 구조: 체크 / 이미지 / SKU / 상품명 / 현재재고 / 상태 / 배치단가 */
.inv-th-img, .inv-td-img { width: 56px; min-width: 56px; max-width: 56px; padding: 6px 8px !important; }
.inv-th-img { } /* 헤더 비움 */
.inv-th-sku, .inv-td-sku { width: 160px; min-width: 140px; }
.inv-td-sku {
  font-family: ui-monospace, 'SF Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.2px;
}

/* 브랜드 헤더 — 띠처럼 강조 (체크박스 없음, 우측에 전체선택 버튼).
   상품 행과 명확히 구분되도록 굵은 보더 + indigo 배경 + 폴더 아이콘. */
.inv-brand-header td {
  background: var(--color-primary-bg);
  border-top: 3px solid var(--color-primary-border);
  border-bottom: 2px solid var(--color-primary-border);
  padding: 10px 14px;
  vertical-align: middle;
}
/* colSpan=7 단일 셀. 폴더아이콘/브랜드명/카운트/전체선택 모두 가로로 좌측 정렬해 한 줄에. */
.inv-brand-cell-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-primary);
}
.inv-brand-cell-inner svg { flex-shrink: 0; }
.inv-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.2px;
}
.inv-brand-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--color-primary-border);
}
.inv-brand-select-all {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  background: #fff;
  border: 1px solid var(--color-primary-border);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  margin-left: 6px; /* 카운트와의 약간 간격 */
  transition: background 0.15s, color 0.15s;
}
.inv-brand-select-all:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.inv-brand-select-all.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* 행 배경 */
.inv-row-even td { background: #fff; }
.inv-row-odd td { background: var(--color-row-zebra); }
.inv-row:hover td { background: var(--color-row-hover); }

/* 상품 셀 */
/* 새 구조: 이미지는 자체 셀(.inv-td-img) 안의 .inv-product-img 박스, 상품명은 별도 셀. */
.inv-product-img { width: 44px; height: 44px; border-radius: 8px; background: var(--color-border); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.inv-product-img img { width: 100%; height: 100%; object-fit: cover; }
.inv-product-img i, .inv-product-img svg { font-size: 20px; color: var(--color-text-muted); }
.inv-product-name { font-size: 13px; font-weight: 500; color: var(--color-text); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* 재고 수치 */
.inv-stock { font-weight: 600; }
.inv-stock.ok { color: #059669; }
.inv-stock.low { color: #dc2626; }
.inv-stock.zero { color: #9ca3af; }

/* 상태 dot */
.inv-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.inv-dot.green { background: #10b981; }
.inv-dot.red { background: #ef4444; }
.inv-dot.yellow { background: #f59e0b; }

/* 적정재고 입력 */
.inv-minstock { display: inline-flex; align-items: center; gap: 4px; }
.inv-minstock-input { width: 50px; padding: 3px 6px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 12px; text-align: center; background: var(--color-bg); outline: none; }
.inv-minstock-input:focus { border-color: var(--color-primary); background: #fff; }

.inv-price { color: var(--color-text-dim); font-size: 13px; }
.inv-empty { text-align: center; padding: 40px 20px; color: var(--color-text-secondary); font-size: 14px; }
.inv-empty i { font-size: 40px; display: block; margin-bottom: 12px; color: #d4c8ba; }

/* 상세 슬라이드 패널 */
.inv-detail-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.3); z-index: 1000; display: flex; justify-content: flex-end; }
.inv-detail-panel { width: 520px; max-width: 90vw; background: #fff; height: 100%; overflow-y: auto; padding: 28px; box-sizing: border-box; animation: slideIn 0.2s ease; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.inv-detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.inv-detail-title { font-size: 18px; font-weight: 700; color: var(--color-text); }
.inv-detail-close { background: none; border: none; cursor: pointer; padding: 4px; color: var(--color-text-secondary); }
.inv-detail-close:hover { color: var(--color-text); }
.inv-detail-product { display: flex; align-items: center; gap: 14px; padding: 16px; background: #fafbfd; border-radius: 12px; margin-bottom: 24px; }
.inv-detail-product-img { width: 56px; height: 56px; border-radius: 10px; background: var(--color-border); display: flex; align-items: center; justify-content: center; }
.inv-detail-product-img i, .inv-detail-product-img svg { font-size: 24px; color: var(--color-text-muted); }
.inv-detail-product-info { flex: 1; }
.inv-detail-product-name { font-size: 16px; font-weight: 600; color: var(--color-text); margin-bottom: 2px; }
.inv-detail-product-sku { font-size: 13px; color: var(--color-text-secondary); }
.inv-detail-product-brand { font-size: 12px; color: var(--color-primary); font-weight: 500; }
/* 매입 참고 정보 카드 — 모달 상단, 통계 카드 위. 데이터 있는 항목만 줄로 표시. */
.inv-sourcing-card { background: #f0f5ff; border: 1px solid var(--color-primary-border)/*≈#c7d2fe*/; border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.inv-sourcing-title { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--color-primary); margin-bottom: 8px; }
.inv-sourcing-row { display: flex; gap: 12px; padding: 4px 0; font-size: 13px; line-height: 1.5; }
.inv-sourcing-label { flex-shrink: 0; width: 56px; color: var(--color-text-secondary); font-weight: 500; font-size: 12px; }
.inv-sourcing-value { flex: 1; color: var(--color-text); word-break: break-all; }
.inv-sourcing-memo { white-space: pre-wrap; }
.inv-sourcing-link { display: block; color: var(--color-primary); text-decoration: none; }
.inv-sourcing-link:hover { text-decoration: underline; }
@media (max-width: 768px) {
  .inv-sourcing-row { flex-direction: column; gap: 2px; padding: 6px 0; }
  .inv-sourcing-label { width: auto; font-size: 11px; }
  .inv-sourcing-value { font-size: 13px; }
}

.inv-detail-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
.inv-detail-stat { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 10px; padding: 12px; text-align: center; }
.inv-detail-stat-label { font-size: 11px; color: var(--color-text-secondary); margin-bottom: 4px; }
.inv-detail-stat-value { font-size: 18px; font-weight: 700; color: var(--color-text); }
.inv-detail-stat-edit { display: flex; align-items: center; justify-content: center; gap: 4px; }
.inv-detail-stat-edit .inv-minstock-input { width: 60px; height: 28px; font-size: 14px; font-weight: 600; }
.inv-detail-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--color-border, #e5e7eb); margin: 4px 0 18px; }
.inv-detail-tab { flex: 1; padding: 9px 8px; font-size: 13px; font-weight: 600; color: var(--color-text-secondary); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.15s; }
.inv-detail-tab:hover { color: var(--color-text-dim); }
.inv-detail-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.inv-detail-section { margin-bottom: 24px; }
.inv-detail-section-title { font-size: 14px; font-weight: 600; color: var(--color-text-dim); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.inv-batch-table { width: 100%; border-collapse: collapse; }
.inv-batch-table th { text-align: left; padding: 8px 10px; font-size: 11px; color: var(--color-text-secondary); font-weight: 600; background: #fafbfd; border-bottom: 1px solid #eee; }
.inv-batch-table td { padding: 8px 10px; font-size: 12px; color: var(--color-text); border-bottom: 1px solid var(--color-border); }
.inv-batch-current { background: var(--color-primary-bg); }
.inv-batch-current td { font-weight: 600; color: var(--color-text-dim); }
.inv-batch-current-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; background: var(--color-primary); color: #fff; font-size: 10px; font-weight: 600; border-radius: 8px; vertical-align: middle; }
.inv-batch-empty { color: var(--color-text-secondary); font-style: italic; padding: 12px 0; font-size: 13px; }
.inv-batch-delta-up { display: inline-flex; align-items: center; gap: 3px; color: #dc2626; font-weight: 500; }
.inv-batch-delta-down { display: inline-flex; align-items: center; gap: 3px; color: #059669; font-weight: 500; }
.inv-batch-delta-flat { display: inline-flex; align-items: center; gap: 3px; color: var(--color-text-secondary); }
.inv-batch-delta-none { color: var(--color-text-muted); }
.inv-adjust-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inv-adjust-field { display: flex; flex-direction: column; gap: 4px; }
.inv-adjust-field label { font-size: 11px; color: var(--color-text-secondary); }
.inv-adjust-field select, .inv-adjust-field input { padding: 7px 10px; border: 1px solid var(--color-border); border-radius: 8px; font-size: 12px; outline: none; }
.inv-adjust-field select:focus, .inv-adjust-field input:focus { border-color: var(--color-primary); }
.inv-adjust-field input[type="number"] { width: 70px; }
.inv-adjust-field input[type="text"] { width: 160px; }
.inv-adjust-btn { padding: 7px 16px; background: var(--color-primary); color: #fff; border: none; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; height: 34px; }
.inv-adjust-btn:hover { background: var(--color-primary-hover); }

/* 조정 이력 */
.inv-adjust-log-wrap { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--color-border); }
.inv-adjust-log-title { font-size: 12px; font-weight: 600; color: var(--color-text-secondary); margin-bottom: 8px; }
.inv-adj-type { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.inv-adj-inc { background: #ecfdf5; color: #047857; }
.inv-adj-dec { background: #fef2f2; color: #b91c1c; }
.inv-comp-list { display: flex; flex-direction: column; gap: 8px; }
.inv-comp-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 8px; }
.inv-comp-arrow { color: var(--color-primary); font-size: 14px; }
.inv-comp-name { font-size: 13px; color: var(--color-text); font-weight: 500; }
.inv-comp-qty { font-size: 12px; color: var(--color-text-secondary); }
.inv-comp-empty { font-size: 13px; color: var(--color-text-secondary); font-style: italic; }

/* 모드 배지 */
.inv-mode-badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 1px 7px; font-size: 10px; font-weight: 600; border-radius: 8px; vertical-align: middle; }
.inv-mode-badge.integrated { background: var(--color-primary); color: #fff; }
.inv-mode-badge.bundle { background: var(--color-primary)/*≈#6366f1*/; color: #fff; }
.inv-mode-badge.normal { background: #e5e1d5; color: var(--color-text-dim); }
.inv-mode-badge.child { background: #94a3b8; color: #fff; }

/* 통합재고 생성 버튼 */
.inv-create-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; height: 36px; background: #fff; color: var(--color-primary); border: 1px solid var(--color-primary); border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.inv-create-btn:hover { background: var(--color-primary-bg); }

/* 팩 변형 안내 */
.inv-pack-hint { font-size: 12px; color: var(--color-text-dim); padding: 8px 12px; background: var(--color-bg); border-left: 3px solid var(--color-primary); border-radius: 4px; margin-bottom: 10px; }
.inv-pack-hint strong { color: var(--color-primary); }

/* 통합재고 생성 모달 */
.inv-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 1100; display: flex; align-items: center; justify-content: center; }
.inv-modal { background: #fff; border-radius: 14px; width: 480px; max-width: 92vw; max-height: 92vh; overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,0.2); padding: 24px; }
.inv-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.inv-modal-title { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; color: var(--color-text); }
.inv-modal-hint { font-size: 12px; color: var(--color-text-secondary); margin-bottom: 16px; line-height: 1.5; }
.inv-modal-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.inv-modal-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--color-text-dim); font-weight: 500; }
.inv-modal-form input { padding: 8px 12px; border: 1px solid var(--color-border); border-radius: 8px; font-size: 13px; outline: none; }
.inv-modal-form input:focus { border-color: var(--color-primary); }
.inv-modal-form .req { color: #dc2626; }
.inv-modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inv-modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.inv-modal-cancel { padding: 8px 18px; background: #fff; color: var(--color-text-dim); border: 1px solid var(--color-border); border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }
.inv-modal-cancel:hover:not(:disabled) { background: var(--color-primary-bg); }
.inv-modal-submit { padding: 8px 18px; background: var(--color-primary); color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.inv-modal-submit:hover:not(:disabled) { background: var(--color-primary-hover); }
.inv-modal-submit:disabled, .inv-modal-cancel:disabled { opacity: 0.5; cursor: not-allowed; }

/* 구성품 섹션 — 통합재고 토글 / 자식 입력 / 검색결과 */
.inv-bundle-toggle { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid; }
.inv-bundle-toggle.on { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.inv-bundle-toggle.on:hover:not(:disabled) { background: var(--color-primary-hover); }
.inv-bundle-toggle.off { background: #fff; color: #b91c1c; border-color: #fecaca; }
.inv-bundle-toggle.off:hover:not(:disabled) { background: #fef2f2; }
.inv-bundle-toggle:disabled { opacity: 0.5; cursor: not-allowed; }

.inv-comp-ded-input { width: 56px; padding: 4px 6px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 12px; text-align: center; background: #fff; outline: none; }
.inv-comp-ded-input:focus { border-color: var(--color-primary); }
.inv-comp-remove { background: none; border: none; cursor: pointer; padding: 4px; color: #b91c1c; border-radius: 6px; }
.inv-comp-remove:hover:not(:disabled) { background: #fef2f2; }
.inv-comp-remove:disabled { opacity: 0.4; cursor: not-allowed; }

.inv-comp-add { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--color-border); }
.inv-comp-add-row { display: flex; gap: 8px; align-items: center; }
.inv-comp-search-wrap { position: relative; flex: 1; }
.inv-comp-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--color-text-secondary); }
.inv-comp-search-input { width: 100%; padding: 7px 10px 7px 30px; border: 1px solid var(--color-border); border-radius: 8px; font-size: 12px; outline: none; box-sizing: border-box; }
.inv-comp-search-input:focus { border-color: var(--color-primary); }
.inv-comp-ded-label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--color-text-dim); white-space: nowrap; }

.inv-comp-search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 100; border: 1px solid var(--color-border); border-radius: 8px; max-height: 240px; overflow-y: auto; background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.inv-comp-search-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--color-primary-bg); }
.inv-comp-search-item:last-child { border-bottom: none; }
.inv-comp-search-item:hover { background: var(--color-bg); }
.inv-comp-add-btn { display: inline-flex; align-items: center; gap: 3px; padding: 4px 10px; background: var(--color-primary); color: #fff; border: none; border-radius: 6px; font-size: 11px; font-weight: 600; cursor: pointer; }
.inv-comp-add-btn:hover:not(:disabled) { background: var(--color-primary-hover); }
.inv-comp-add-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.inv-detail-section-title { display: flex; align-items: center; gap: 6px; }

@media (max-width: 768px) {
  .inv-page { padding: 16px; }
  .inv-summary { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .inv-summary-value { font-size: 20px; }
  .inv-toolbar { flex-wrap: wrap; gap: 8px; }
  .inv-search-box { width: 100%; }
  .inv-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .inv-table { min-width: 600px; }
  /* 상세패널: 모바일에선 하단에서 슬라이드업 모달 형태 */
  .inv-detail-panel {
    width: 100%; max-width: 100vw;
    top: auto; bottom: 0; height: 75vh;
    border-left: none; border-top: 1px solid var(--color-border);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
  }
}

/* 작은 폰 */
@media (max-width: 480px) {
  .inv-page { padding: 10px; }
  .inv-summary { grid-template-columns: 1fr 1fr; }
  .inv-summary-value { font-size: 18px; }
}

/* ============================================================
   모바일 재고 페이지 — PC 기능 100% 포함
   ============================================================ */

/* 요약 카드 — 2x2 격자 */
.inv-m-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.inv-m-summary-card {
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.inv-m-summary-card.inv-m-summary-danger { border-color: var(--color-danger-bg); background: var(--color-danger-bg); }
.inv-m-summary-card.inv-m-summary-warning { border-color: var(--color-warning-bg); background: var(--color-primary-bg); }

.inv-m-summary-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.inv-m-summary-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}

/* 모바일 필터 드롭다운 — 검색창 옆 */
.inv-m-filter-select {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3e%3cpath fill='%238a8470' d='M1 3l4 4 4-4z'/%3e%3c/svg%3e") no-repeat right 8px center;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  max-width: 120px;
}
.inv-m-filter-select:focus { border-color: var(--color-primary); }

/* 검색 + 필터 + 통합재고 만들기 */
.inv-m-search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.inv-m-search {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a8470' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 10px center no-repeat;
  font-size: 13px;
  color: var(--color-text);
  outline: none;
}
.inv-m-search:focus { border-color: var(--color-primary); }

.inv-m-create-btn {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--color-primary);
  border-radius: 10px;
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.inv-m-create-btn:active { background: var(--color-primary-hover); }

/* 리스트 + 브랜드 그룹.
   가상화 적용: position:relative 컨테이너, 자식 row 들이 position:absolute + translateY 로
   배치됨. 카드 간 간격은 wrapper 안쪽 padding-bottom 으로 만든다. */
.inv-m-list {
  padding-bottom: 80px; /* 하단 액션바 공간 */
}
.inv-m-virtual-brand-wrap { padding-bottom: 6px; }
.inv-m-virtual-item-wrap  { padding-bottom: 6px; }

/* 브랜드 헤더 — 체크박스 없음. 좌측: 접기버튼+이름+개수, 우측: 전체선택 버튼.
   상품 카드와 시각적으로 구분되도록 indigo bg 띠 + 굵은 보더. */
.inv-m-brand-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: var(--color-primary-bg);
  border: 1.5px solid var(--color-primary-border);
  border-radius: 10px;
  margin-top: 4px;
}
/* title 은 자연너비 (flex:1 제거) → 전체선택 버튼이 브랜드명 바로 옆에 붙음.
   긴 브랜드명은 .inv-m-brand-name 의 max-width + ellipsis 로 잘림. */
.inv-m-brand-title {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  min-width: 0;
  flex-shrink: 1;
}
.inv-m-brand-title svg { color: var(--color-primary); flex-shrink: 0; }
.inv-m-brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-m-brand-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: #fff;
  border: 1px solid var(--color-primary-border);
  padding: 2px 7px;
  border-radius: 9px;
  flex-shrink: 0;
}
.inv-m-brand-select-all {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  background: #fff;
  border: 1px solid var(--color-primary-border);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.inv-m-brand-select-all.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.inv-m-brand-select-all:active {
  background: var(--color-primary-hover);
  color: #fff;
  border-color: var(--color-primary-hover);
}

/* 상품 카드 */
.inv-m-item-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inv-m-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.inv-m-item-row input[type="checkbox"] { accent-color: var(--color-primary); flex-shrink: 0; }
.inv-m-item-img {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}
.inv-m-item-img > img { width: 100%; height: 100%; object-fit: cover; }
.inv-m-item-img svg { color: var(--color-text-muted); }
.inv-m-item-info { flex: 1; min-width: 0; cursor: pointer; }
/* 모바일 카드: SKU(위) → 품명(아래) 순서. SKU 강조 (큰 글씨 + 진한 색). */
.inv-m-item-sku-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.inv-m-item-sku {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  font-family: ui-monospace, 'SF Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  letter-spacing: 0.2px;
}
/* 품명 — 중요 정보이므로 진한 색 + 중간 굵기. 긴 텍스트는 줄바꿈으로 전체 노출 (ellipsis 제거). */
.inv-m-item-name-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  max-width: 100%;
  line-height: 1.4;
}

.inv-m-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid transparent;
}
.inv-m-mode-badge.integrated { background: var(--color-primary-bg); color: var(--color-warning); border-color: var(--color-primary-border); }
.inv-m-mode-badge.bundle { background: var(--color-info-bg); color: var(--color-info); border-color: var(--color-info-bg); }
.inv-m-mode-badge.child { background: var(--color-danger-bg); color: var(--color-warning); border-color: var(--color-danger-bg); }
.inv-m-mode-badge.normal { background: var(--color-primary-bg); color: var(--color-text-dim); border-color: var(--color-border); }

.inv-m-item-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}
.inv-m-stat { display: flex; flex-direction: column; gap: 3px; }
.inv-m-stat-label { font-size: 10px; color: var(--color-text-secondary); }
.inv-m-stat-value { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--color-text); }

.inv-m-stock.low { color: #c0392b; }
.inv-m-stock.zero { color: var(--color-text-secondary); }
.inv-m-stock.ok { color: var(--color-text); }

.inv-m-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.inv-m-dot.red { background: #e74c3c; }
.inv-m-dot.yellow { background: #f1c40f; }
.inv-m-dot.green { background: #2ecc71; }

.inv-m-minstock-input {
  width: 100%;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  font-size: 13px;
  text-align: right;
  color: var(--color-text);
}
.inv-m-minstock-input:focus { border-color: var(--color-primary); background: #fff; }

/* 하단 액션바 — BottomTabs(safe-area 포함) 위에 정확히 위치.
   z-index 200: BottomTabs(z=100) 보다 높게. */
.inv-m-bulk-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--bottomtab-height, 60px) + env(safe-area-inset-bottom, 0px));
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 200;
  backdrop-filter: blur(6px);
}
.inv-m-bulk-count { font-size: 13px; font-weight: 600; color: var(--color-text); }
.inv-m-bulk-clear {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  color: var(--color-text-dim);
  cursor: pointer;
}
.inv-m-bulk-primary {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: var(--color-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

/* 상세 풀스크린 모달 — portal 로 body 직속 마운트 → viewport 전체 차지 가능.
   z-index 9999 로 TopNavBar/BottomTabs(z=100) 위에 자연스럽게. 자체 닫기 버튼
   포함되어 있어 풀스크린이어도 사용자가 빠져나오기 어렵지 않음.
   페이지 스크롤 위치와 무관하게 모달이 viewport(top:0 ~ bottom:0)를 정확히
   채우므로 #8의 "빈 공간" 문제 해소. */
.inv-m-detail-modal {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inv-m-detail-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
}
.inv-m-detail-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text);
}
.inv-m-detail-close:active { background: var(--color-border); }
.inv-m-detail-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.inv-m-detail-product {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
}
.inv-m-detail-product-img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.inv-m-detail-product-img > img { width: 100%; height: 100%; object-fit: cover; }
.inv-m-detail-product-img svg { color: var(--color-text-muted); }
.inv-m-detail-product-info { flex: 1; min-width: 0; }
.inv-m-detail-product-name { font-size: 14px; font-weight: 600; color: var(--color-text); }
.inv-m-detail-product-sku { font-size: 11px; color: var(--color-text-secondary); font-family: 'SFMono-Regular', Menlo, monospace; margin-top: 2px; }
.inv-m-detail-product-brand { font-size: 11px; color: var(--color-text-secondary); margin-top: 1px; }

/* 탭 */
.inv-m-detail-tabs {
  flex-shrink: 0;
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.inv-m-detail-tabs::-webkit-scrollbar { display: none; }
.inv-m-detail-tab {
  flex: 1;
  min-width: 80px;
  padding: 12px 8px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.inv-m-detail-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

.inv-m-detail-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.inv-m-tab-body {
  padding: 14px;
}

.inv-m-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-dim);
  margin: 8px 0 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.inv-m-detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.inv-m-detail-stat {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.inv-m-detail-stat-label { font-size: 10px; color: var(--color-text-secondary); }
.inv-m-detail-stat-value { font-size: 14px; font-weight: 700; color: var(--color-text); }
.inv-m-detail-stat-edit { display: flex; align-items: center; gap: 4px; }
.inv-m-detail-stat-edit .inv-m-minstock-input { width: 60px; height: 30px; font-size: 14px; font-weight: 600; }

.inv-m-mode-info {
  font-size: 13px;
  color: var(--color-text-dim);
  margin-bottom: 10px;
}
.inv-m-mode-btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.inv-m-mode-btn.on {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.inv-m-mode-btn.off {
  background: #fff;
  color: #c0392b;
  border-color: var(--color-danger-bg);
}

.inv-m-empty-state {
  padding: 24px 12px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 13px;
  background: #fff;
  border: 1px dashed var(--color-border);
  border-radius: 10px;
}

.inv-m-hint {
  background: var(--color-primary-bg);
  border: 1px solid var(--color-primary-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-dim);
  margin-bottom: 10px;
}

/* 배치이력 카드 리스트 */
.inv-m-batch-list { display: flex; flex-direction: column; gap: 6px; }
.inv-m-batch-row {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
}
.inv-m-batch-row.current {
  background: var(--color-primary-bg);
  border-color: var(--color-primary-border);
}
.inv-m-batch-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.inv-m-batch-date { font-size: 13px; font-weight: 600; color: var(--color-text); }
.inv-m-batch-current-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--color-primary);
  color: #fff;
}
.inv-m-batch-price { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--color-text); }
.inv-m-batch-bot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--color-text-dim);
}

/* 구성품 */
.inv-m-comp-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.inv-m-comp-row {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.inv-m-comp-info { flex: 1; min-width: 0; }
.inv-m-comp-name { font-size: 13px; font-weight: 500; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-m-comp-sku { font-size: 11px; color: var(--color-text-secondary); font-family: 'SFMono-Regular', Menlo, monospace; margin-top: 1px; }
.inv-m-comp-controls { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.inv-m-comp-ded {
  width: 56px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  text-align: right;
  background: var(--color-bg);
}
.inv-m-comp-ded:focus { border-color: var(--color-primary); background: #fff; }
.inv-m-comp-ded-unit { font-size: 11px; color: var(--color-text-secondary); }
.inv-m-comp-remove {
  width: 30px;
  height: 30px;
  border: 1px solid var(--color-danger-bg);
  border-radius: 6px;
  background: var(--color-danger-bg);
  color: #c0392b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.inv-m-comp-remove:disabled { opacity: 0.4; cursor: not-allowed; }

.inv-m-comp-add-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}
.inv-m-comp-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0 10px;
}
.inv-m-comp-search-icon { color: var(--color-text-secondary); flex-shrink: 0; }
.inv-m-comp-search-input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--color-text);
  outline: none;
}
.inv-m-comp-ded-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}
.inv-m-comp-search-results {
  margin-top: 6px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
  max-height: 240px;
  overflow-y: auto;
}
.inv-m-comp-search-item {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
}
.inv-m-comp-search-item:last-child { border-bottom: none; }
.inv-m-comp-search-item:active { background: var(--color-bg); }
.inv-m-comp-cand-name { font-size: 13px; font-weight: 500; color: var(--color-text); }
.inv-m-comp-cand-sub { font-size: 11px; color: var(--color-text-secondary); margin-top: 1px; }
.inv-m-comp-add-btn {
  padding: 6px 10px;
  border: 1px solid var(--color-primary);
  border-radius: 6px;
  background: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  flex-shrink: 0;
}
.inv-m-comp-add-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 조정 */
.inv-m-adjust-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px;
}
.inv-m-adjust-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--color-text-secondary);
}
.inv-m-adjust-label select,
.inv-m-adjust-label input {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  font-size: 13px;
  color: var(--color-text);
  outline: none;
}
.inv-m-adjust-label select:focus,
.inv-m-adjust-label input:focus { border-color: var(--color-primary); background: #fff; }

.inv-m-adjust-btn {
  height: 40px;
  border: none;
  border-radius: 8px;
  background: var(--color-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.inv-m-adjust-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.inv-m-adj-list { display: flex; flex-direction: column; gap: 6px; }
.inv-m-adj-row {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
}
.inv-m-adj-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.inv-m-adj-type {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}
.inv-m-adj-type.inc { background: #e7f5ec; color: var(--color-success); }
.inv-m-adj-type.dec { background: var(--color-danger-bg); color: #c0392b; }
.inv-m-adj-qty { font-size: 13px; font-weight: 700; color: var(--color-text); flex: 1; }
.inv-m-adj-mid {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 2px;
}
.inv-m-adj-date { font-family: 'SFMono-Regular', Menlo, monospace; }
.inv-m-adj-delta { font-weight: 500; }
.inv-m-adj-reason {
  font-size: 12px;
  color: var(--color-text-dim);
  line-height: 1.4;
}

/* 플로팅 캡슐 — 체크 시 밑에서 떠오르는 매입 등록 (소싱/대량등록 캡슐과 동일 톤) */
.inv-capsule { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; background: #1e2330; color: #fff;
  padding: 9px 12px 9px 18px; border-radius: 999px;
  box-shadow: 0 14px 36px -10px rgba(0,0,0,.5), 0 3px 10px rgba(0,0,0,.22);
  animation: invCapUp .28s cubic-bezier(.2,.85,.25,1); }
@keyframes invCapUp { from { opacity: 0; transform: translate(-50%, 26px); } to { opacity: 1; transform: translate(-50%, 0); } }
.inv-cap-count { font-size: 14px; font-weight: 800; white-space: nowrap; }
.inv-cap-clear { width: 26px; height: 26px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.1); color: #b8bec7; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.inv-cap-clear:hover { background: rgba(255,255,255,.22); color: #fff; }
.inv-cap-btn { border: none; cursor: pointer; background: var(--color-primary, #ee4d2d); color: #fff;
  padding: 9px 22px; border-radius: 999px; font-size: 14px; font-weight: 800; white-space: nowrap; }
.inv-cap-btn:hover { filter: brightness(1.06); }
.pur-page { padding: 20px 24px; width: 100%; }

/* 탭 */
.pur-main-tabs { display: flex; gap: 0; border-bottom: 2px solid #e8e9ef; margin-bottom: 16px; }
.pur-main-tab { padding: 10px 24px; font-size: 15px; font-weight: 600; color: var(--color-text-secondary); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.pur-main-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* 요약 카드 */
.pur-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.pur-summary-card { background: #fff; border-radius: 12px; padding: 20px 22px; border: 1px solid #eee; }
.pur-summary-label { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.pur-summary-label svg { width: 16px; height: 16px; }
.pur-summary-value { font-size: 26px; font-weight: 700; color: var(--color-text); }
.pur-summary-value.income { color: #059669; }

/* 툴바 */
.pur-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pur-filters-wrap { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pur-toolbar-row { display: flex; align-items: center; gap: 12px; }  /* 카테고리 + 검색 같은 줄 (#7) */
.pur-filters { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.pur-filter-btn { padding: 7px 16px; height: 36px; border-radius: 20px; border: 1px solid var(--color-border); background: #fff; font-size: 13px; color: var(--color-text-dim); cursor: pointer; font-weight: 500; transition: all 0.15s; box-sizing: border-box; }
.pur-filter-btn:hover { background: var(--color-primary-bg); }
.pur-filter-btn.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
/* 검색바 — 레이아웃만. 검색창 비주얼(돋보기/배경)은 전역 규칙(index.css #8)이 처리. */
.pur-search-box { flex: 1; min-width: 200px; }
.pur-search-box input { width: 100%; padding: 8px 14px; font-size: 13px; outline: none; box-sizing: border-box; height: 36px; }

/* 날짜 범위 + 정렬 */
.pur-date-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pur-date-picker { padding: 7px 12px; height: 36px; border: 1px solid var(--color-border); border-radius: 10px; font-size: 13px; outline: none; background: #fff; box-sizing: border-box; }
.pur-date-picker:focus { border-color: var(--color-primary); }
.pur-date-sep { color: var(--color-text-secondary); font-size: 13px; }
.pur-sort-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; height: 36px; border: 1px solid var(--color-border); border-radius: 10px; background: #fff; font-size: 13px; color: var(--color-text-dim); cursor: pointer; font-weight: 500; white-space: nowrap; transition: all 0.15s; box-sizing: border-box; }
.pur-sort-btn:hover { background: var(--color-primary-bg); }
.pur-sort-btn svg { width: 16px; height: 16px; }

/* 액션 바 */
.pur-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.pur-add-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 16px; height: 36px; background: var(--color-primary); color: #fff; border: none; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.pur-add-btn:hover { background: var(--color-primary-hover); }
.pur-add-btn svg { width: 14px; height: 14px; }
.pur-shortcut-hint { font-size: 11px; color: var(--color-text-secondary); margin-left: auto; white-space: nowrap; }

/* 테이블 — table-layout: fixed로 컬럼 너비를 th 폭에 강제 고정.
   셀 안의 input/dropdown이 셀을 가로로 늘리지 못하게 막아 입력 모드에서 행 흔들림 방지. */
/* dropdown이 셀 밖으로 escape할 수 있게 vertical은 visible. horizontal만 auto. */
.pur-table-wrap { background: #fff; border-radius: 12px; border: 1px solid #eee; overflow-x: auto; overflow-y: visible; }
.pur-table { width: 100%; border-collapse: collapse; min-width: 1010px; table-layout: fixed; }
.pur-table th { text-align: left; padding: 9px 10px; font-size: 12px; color: var(--color-text-secondary); font-weight: 600; background: #fafbfd; border-bottom: 1px solid #eee; white-space: nowrap; box-sizing: border-box; position: relative; user-select: none; }

/* 컬럼 리사이즈 핸들 — th 오른쪽 끝에 4px 너비 가시 영역 */
.pur-col-resize {
  position: absolute; top: 0; right: 0; width: 6px; height: 100%;
  cursor: col-resize; user-select: none;
}
.pur-col-resize:hover { background: rgba(99, 102, 241, 0.25); }
.pur-col-resize:active { background: rgba(99, 102, 241, 0.5); }
.pur-table td { padding: 0; font-size: 13px; color: var(--color-text); border-bottom: 1px solid var(--color-border); vertical-align: middle; box-sizing: border-box; overflow: hidden; }
/* dropdown은 Portal로 body에 렌더되니 td overflow:visible 불필요 */
/* 열 간 세로 구분선 — 마지막 열은 제외해 우측 이중 보더 방지.
   날짜 헤더/빈 상태 row는 colSpan=10으로 단일 td라 자연스럽게 영향 없음. */
.pur-table th,
.pur-table td { border-right: 1px solid var(--color-border); }
.pur-table th:last-child,
.pur-table td:last-child { border-right: none; }

/* 컬럼 너비는 colgroup <col>(colWidths state) 가 단독으로 결정 → 드래그 리사이즈 작동.
   여기서 th 에 고정 width 를 주면 colgroup 을 덮어써서 리사이즈가 안 먹음 (제거함). */

/* 날짜 헤더 — 재고관리 브랜드 행과 동일 띠 스타일. indigo bg + 굵은 보더로 강조. */
.pur-date-header td {
  background: var(--color-primary-bg);
  border-top: 3px solid var(--color-primary-border) !important;
  border-bottom: 2px solid var(--color-primary-border) !important;
  border-right: none !important;
  font-weight: 700;
  font-size: 13px;
  color: var(--color-text);
  padding: 10px 14px !important;
  vertical-align: middle;
}
.pur-date-header svg { width: 14px; height: 14px; margin-right: 6px; vertical-align: middle; color: var(--color-primary); }
.pur-date-count {
  font-size: 11px; font-weight: 600;
  color: var(--color-text-secondary);
  background: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--color-primary-border);
  margin-left: 12px;
}
.pur-date-sum {
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 700;
  margin-left: 10px;
}

/* 행 배경 */
.pur-row-even td { background: #fff; }
.pur-row-odd td { background: #fafbfd; }
.pur-row:hover td { background: var(--color-primary-bg); }
.pur-row-new td { background: #fefce8; }

/* 셀 공통 — 모든 셀 컨테이너는 정확히 38px 높이로 고정. display↔edit 전환 시 행이
   움직이지 않도록 input/select/dropdown 모두 26px(=38-12padding) 안에 맞춤. */
.pur-cell { padding: 6px 10px; cursor: pointer; height: 38px; box-sizing: border-box; display: flex; align-items: center; overflow: hidden; }
.pur-cell-text { font-size: 13px; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; min-width: 0; }
.pur-cell-placeholder { color: var(--color-text-secondary); }
.pur-cell-required { border: 1.5px solid #ef4444; border-radius: 4px; margin: 2px; }

/* 잠금 셀 — 상품사입 외 분류에서 SKU/수량 비활성 (#4) */
.pur-cell-locked {
  background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 6px, #eceef1 6px, #eceef1 12px);
  color: #9ca3af; cursor: not-allowed; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.pur-cell-locked .pur-cell-text { color: #b0b6bf; }

/* 배송비 분배 (#2) */
.pur-ship-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; font-size: 13px; font-weight: 600; border: 1px solid var(--color-primary, #6366f1); color: var(--color-primary, #6366f1); background: #fff; border-radius: 8px; cursor: pointer; }
.pur-ship-btn:hover { background: var(--color-primary-bg, #eef2ff); }
.pur-ship-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.pur-ship-modal { background: #fff; border-radius: 16px; width: 640px; max-width: calc(100vw - 32px); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 16px 50px rgba(0,0,0,0.22); }
.pur-ship-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; font-size: 18px; font-weight: 700; border-bottom: 1px solid #eef0f2; }
.pur-ship-head span { display: inline-flex; align-items: center; gap: 8px; }
.pur-ship-x { background: none; border: none; font-size: 20px; cursor: pointer; color: #9ca3af; line-height: 1; }
.pur-ship-x:hover { color: #111827; }
.pur-ship-desc { padding: 16px 24px 4px; font-size: 13px; color: var(--color-text-secondary, #6b7280); line-height: 1.6; }
.pur-ship-amount-row { display: flex; align-items: center; gap: 12px; padding: 10px 24px; }
.pur-ship-amount-row label { font-size: 14px; font-weight: 600; min-width: 48px; }
.pur-ship-amount-row input { flex: 1; height: 44px; padding: 0 14px; border: 1.5px solid var(--color-primary, #6366f1); border-radius: 10px; font-size: 17px; outline: none; }
.pur-ship-amount-row select { height: 44px !important; font-size: 15px !important; }
.pur-ship-amount-row span { font-size: 14px; color: var(--color-text-secondary,#6b7280); }
.pur-ship-hint { padding: 2px 24px 10px; font-size: 13px; font-weight: 600; color: var(--color-primary); }
.pur-ship-listhead { display: flex; justify-content: space-between; align-items: center; padding: 10px 24px; border-top: 1px solid #eef0f2; background: #fafbfc; }
.pur-ship-selall { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--color-text-secondary,#6b7280); cursor: pointer; }
.pur-ship-selall input, .pur-ship-item input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }
.pur-ship-count { font-size: 14px; font-weight: 700; color: var(--color-primary,#6366f1); }
.pur-ship-item-sup { margin-left: 8px; font-size: 12px; color: #4b5563; background: #eef0f2; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.pur-ship-list { flex: 1; overflow-y: auto; padding: 6px 14px; }
.pur-ship-empty { padding: 28px; text-align: center; color: #9ca3af; font-size: 14px; }
.pur-ship-item { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: 10px; cursor: pointer; border-bottom: 1px solid #f6f7f8; }
.pur-ship-item:last-child { border-bottom: none; }
.pur-ship-item:hover { background: var(--color-primary-bg)/*≈#f5f7ff*/; }
.pur-ship-item-name { flex: 1; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pur-ship-item-name em { color: #9ca3af; font-style: normal; font-size: 13px; margin-left: 2px; }
.pur-ship-item-amt { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pur-ship-item-amt b { color: var(--color-primary, #6366f1); font-size: 14px; }
.pur-ship-foot { display: flex; gap: 10px; padding: 16px 24px; border-top: 1px solid #eef0f2; }
.pur-ship-cancel { flex: 1; height: 46px; border: 1px solid var(--color-border, #e5e7eb); background: #fff; border-radius: 10px; cursor: pointer; font-size: 15px; }
.pur-ship-apply { flex: 2; height: 46px; border: none; background: var(--color-primary, #6366f1); color: #fff; border-radius: 10px; cursor: pointer; font-size: 15px; font-weight: 700; }
.pur-ship-apply:hover { background: var(--color-primary-hover, #4f46e5); }

/* 월 선택 버튼 (#2) */
.pur-month-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.pur-month-btn { font-size: 12px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--color-border, #e5e7eb); background: #fff; color: var(--color-text-secondary, #6b7280); cursor: pointer; }
.pur-month-btn:hover { background: var(--color-bg, #f9fafb); }
.pur-month-btn.active { background: var(--color-primary, #a08840); color: #fff; border-color: var(--color-primary, #a08840); }

/* 월 선택 드롭다운 (주문정산탭과 동일 컨셉) */
.pur-month-select-wrap { display: inline-flex; }
.pur-month-select {
  font-size: 13px;
  padding: 7px 28px 7px 10px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--color-border, #e5e7eb);
  background: #fff;
  color: var(--color-text, #111);
  cursor: pointer;
}

/* 필터 버튼 우측 정렬 (가독성) — 검색은 왼쪽, 필터 버튼은 오른쪽으로 */
.pur-toolbar-row .pur-search-box { order: 1; }
.pur-toolbar-row .pur-filters { order: 2; }
.pur-subfilters { justify-content: flex-end; }

/* 결제수단 클릭 드롭다운 (#5) */
.pur-pay-drop { position: relative; cursor: pointer; padding: 4px 6px; min-height: 26px; display: flex; align-items: center; border-radius: 4px; }
.pur-pay-drop:hover { background: var(--color-bg, #f9fafb); }
/* Portal(.pur-portal-dd) 안에 렌더 → static. 위치는 PortalDropdown 이 계산. */
.pur-pay-menu {
  min-width: 110px;
  background: #fff; border: 1px solid var(--color-border, #e5e7eb); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.14); overflow: hidden;
}
.pur-pay-item { padding: 10px 14px; font-size: 13px; cursor: pointer; text-align: center; transition: background .1s; }
.pur-pay-item:hover { background: var(--color-primary-bg, #eef2ff); color: var(--color-primary, #6366f1); font-weight: 600; }
.pur-pay-item.active { background: var(--color-primary, #6366f1); color: #fff; font-weight: 600; }
.pur-pay-item.active:hover { background: var(--color-primary-hover, #4f46e5); color: #fff; }

/* 결제수단 하위 필터 (#10) */
.pur-filters-wrap { display: flex; flex-direction: column; gap: 6px; }
.pur-subfilters { display: flex; gap: 6px; flex-wrap: wrap; }
.pur-subfilter-btn {
  font-size: 12px; padding: 4px 10px; border-radius: 14px;
  border: 1px solid var(--color-border, #e5e7eb); background: #fff;
  color: var(--color-text-secondary, #6b7280); cursor: pointer; transition: all 0.12s;
}
.pur-subfilter-btn:hover { background: var(--color-bg, #f9fafb); }
.pur-subfilter-btn.active { background: var(--color-primary, #a08840); color: #fff; border-color: var(--color-primary, #a08840); }
.pur-cell-input { width: 100%; height: 26px; padding: 0 6px; border: 1.5px solid var(--color-primary); border-radius: 4px; font-size: 13px; outline: none; background: #fff; box-sizing: border-box; }
.pur-cell-input:focus { box-shadow: inset 0 0 0 1px rgba(160,136,64,0.25); }
.pur-cell-num { text-align: right; }
.pur-cell-select { width: 100%; height: 26px; padding: 0 4px; border: 1.5px solid var(--color-primary); border-radius: 4px; font-size: 13px; outline: none; background: #fff; cursor: pointer; box-sizing: border-box; }

/* SKU 셀 썸네일 */
.pur-cell-thumb { width: 22px; height: 22px; border-radius: 3px; object-fit: cover; flex-shrink: 0; margin-right: 6px; vertical-align: middle; }
.pur-cell-thumb-empty { display: inline-flex; align-items: center; justify-content: center; background: var(--color-border); color: var(--color-text-muted); }

/* SKU 셀 안의 브랜드 / SKU / 품명 분리 표시 — 같은 셀 한 줄, 순서대로 좌→우 */
.pur-sku-cell-brand {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-bg);
  border: 1px solid var(--color-primary-border);
  padding: 2px 8px;
  border-radius: 9px;
  margin-right: 6px;
  flex-shrink: 0;
}
.pur-sku-cell-code {
  font-family: ui-monospace, 'SF Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.2px;
  margin-right: 6px;
  flex-shrink: 0;
}
.pur-sku-cell-name {
  font-weight: 500;
  color: var(--color-text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* 숫자 셀 (수량/매입가) — 가운데 정렬 + 네이티브 number spinner 제거 */
.pur-td-num .pur-cell { justify-content: center; }
/* 거래명 가운데 정렬 (#6) */
.pur-td-title .pur-cell { justify-content: center; }
.pur-td-title .pur-cell-text { justify-content: center; text-align: center; width: 100%; }
.pur-td-num .pur-cell-text { display: block; text-align: center; width: 100%; }
.pur-td-num .pur-cell-input,
.pur-cell-num { text-align: center; }
.pur-cell-num::-webkit-outer-spin-button,
.pur-cell-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pur-cell-num { -moz-appearance: textfield; appearance: textfield; }

/* 결제수단 / 매입처 컬럼 — 가운데 정렬 */
.pur-td-pay .pur-cell { justify-content: center; }
.pur-td-pay .pur-cell-text { text-align: center; }
.pur-td-pay .pur-cell-select { text-align: center; text-align-last: center; }
/* 결제수단 드롭다운(커스텀) 가운데 정렬 */
.pur-td-pay .pur-pay-drop { justify-content: center; }
.pur-td-pay .pur-pay-drop .pur-cell-text { justify-content: center; width: 100%; }
.pur-td-sup .pur-supplier-drop { justify-content: center; }
.pur-td-sup .pur-supplier-drop > .pur-cell-text { text-align: center; }
/* 지출분류 셀 가운데 정렬 */
.pur-td-cat .pur-pay-drop { justify-content: center; }
.pur-td-cat .pur-pay-drop .pur-cell-text { justify-content: center; width: 100%; }
/* 헤더(th) — 상품(SKU) 빼고 전부 가운데 정렬 */
.pur-table th { text-align: center; }
.pur-table th.pur-th-sku { text-align: left; }

/* SKU 셀 — input만 셀 안. 후보 list는 Portal로 body에 렌더(.pur-portal-dd) */
.pur-sku-drop { position: relative; cursor: pointer; padding: 6px 10px; height: 38px; box-sizing: border-box; display: flex; align-items: center; overflow: hidden; }

/* Portal dropdown 컨테이너 — body 레벨, position: fixed. 클릭 영역 + 클립핑 무관 */
.pur-portal-dd { background: #fff; border: 1px solid #eee; border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,0.18); overflow: hidden; min-width: 200px; }
.pur-portal-dd-list { max-height: 320px; overflow-y: auto; padding: 4px; }
.pur-sku-list { max-height: 240px; overflow-y: auto; }
.pur-sku-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; transition: background 0.12s; }
.pur-sku-item:hover { background: var(--color-primary-bg); }
.pur-sku-item-img { width: 32px; height: 32px; border-radius: 6px; background: var(--color-border); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.pur-sku-item-img img { width: 100%; height: 100%; object-fit: cover; }
.pur-sku-item-img svg { color: var(--color-text-muted); }
.pur-sku-item-info { display: flex; flex-direction: column; }
.pur-sku-item-name { font-size: 13px; font-weight: 500; color: var(--color-text); }
.pur-sku-item-code { font-size: 11px; color: var(--color-text-secondary); }
.pur-sku-empty { padding: 16px; text-align: center; color: var(--color-text-secondary); font-size: 13px; }

/* 매입처 셀 — input만 셀 안. 후보 list는 Portal */
.pur-supplier-drop { position: relative; cursor: pointer; padding: 6px 10px; height: 38px; box-sizing: border-box; display: flex; align-items: center; overflow: hidden; }
.pur-supplier-item { padding: 4px 6px; cursor: pointer; transition: background 0.12s; border-radius: 6px; }
.pur-supplier-item:hover { background: var(--color-primary-bg); }
.pur-supplier-create { border-top: 1px dashed var(--color-border); margin-top: 4px; padding-top: 8px; }
.pur-supplier-empty { padding: 16px; text-align: center; color: var(--color-text-secondary); font-size: 12px; }

/* 매입처 pill — Airtable singleSelect 스타일 */
.pur-supplier-pill { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; border: 1px solid transparent; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

/* 액션 버튼 */
.pur-td-act { padding: 4px 6px !important; }
.pur-act-btn { background: none; border: none; cursor: pointer; padding: 4px; color: var(--color-text-secondary); border-radius: 6px; transition: all 0.15s; }
.pur-act-btn:hover { background: var(--color-primary-bg); color: var(--color-text-dim); }
.pur-act-btn svg { width: 14px; height: 14px; }
.pur-act-del:hover { background: #fef2f2; color: #b91c1c; }

/* 빈 상태 */
.pur-empty { text-align: center; padding: 40px 20px !important; color: var(--color-text-secondary); font-size: 14px; }
.pur-empty svg { display: block; margin: 0 auto 12px; color: #d4c8ba; }

/* 반응형 */
@media (max-width: 768px) {
  .pur-page { padding: 16px; }
  .pur-summary { grid-template-columns: 1fr; gap: 8px; }
  .pur-summary-value { font-size: 20px; }
  .pur-toolbar { flex-wrap: wrap; gap: 8px; }
  .pur-filters { width: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .pur-search-box { width: 100%; }
  .pur-date-bar { flex-wrap: wrap; gap: 8px; }
  .pur-actions { flex-wrap: wrap; }
  .pur-shortcut-hint { display: none; }
  .pur-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pur-table { min-width: 1000px; }
  /* iOS: 입력칸 글자 16px 미만이면 포커스 시 화면이 자동 확대됨 → 16px로 고정(확대 방지, 핀치줌은 유지) */
  .pur-cell-input, .pur-cell-select { font-size: 16px; }
}

/* 작은 폰 */
@media (max-width: 480px) {
  .pur-page { padding: 10px; }
  .pur-summary-value { font-size: 18px; }
}

/* ============================================================
   매입/지출 모바일
   PC 와 동일한 모든 기능을 모바일 UI 로 제공.
   클래스 prefix: .pur-m-*
   ============================================================ */

/* 요약 카드 — 3개 가로 grid */
.pur-m-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.pur-m-summary-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 12px;
}
.pur-m-summary-label {
  font-size: 11px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}
.pur-m-summary-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pur-m-summary-success .pur-m-summary-value { color: var(--color-success); }

/* 검색 + 정렬 + 즐겨찾기 row */
.pur-m-toolbar-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.pur-m-search {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: 13px;
  background: #fff;
  outline: none;
}
.pur-m-search:focus { border-color: var(--color-primary); }
.pur-m-icon-btn {
  position: relative;
  width: 38px; height: 38px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-dim);
  cursor: pointer;
  flex-shrink: 0;
}
.pur-m-icon-btn:active { background: var(--color-primary-bg); }

/* 카테고리 칩 — 6개를 3×2 그리드로 한눈에 보기 (가로 스크롤 X) */
.pur-m-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.pur-m-chip {
  padding: 6px 8px;
  height: 32px;
  border-radius: 16px;
  border: 1px solid var(--color-border);
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-dim);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  min-width: 0;
}
.pur-m-chip.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* 날짜 범위 */
.pur-m-date-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.pur-m-date {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  outline: none;
  min-width: 0;
}
.pur-m-date:focus { border-color: var(--color-primary); }
.pur-m-date-sep { color: var(--color-text-secondary); font-size: 13px; flex-shrink: 0; }

/* + 새 행 추가 (전체 너비) */
.pur-m-add-btn {
  width: 100%;
  height: 40px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  margin-bottom: 12px;
}
.pur-m-add-btn:active { background: var(--color-primary-hover); }

/* 리스트 — 날짜 그룹 */
.pur-m-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 80px;
}
.pur-m-date-group { display: flex; flex-direction: column; gap: 6px; }

/* 날짜 헤더 — 재고관리 브랜드 행과 동일한 띠 스타일 */
.pur-m-date-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--color-primary-bg);
  border: 1.5px solid var(--color-primary-border);
  border-radius: 10px;
}
.pur-m-date-header svg { color: var(--color-primary); flex-shrink: 0; }
.pur-m-date-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pur-m-date-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: #fff;
  padding: 2px 7px;
  border-radius: 9px;
  border: 1px solid var(--color-primary-border);
  flex-shrink: 0;
}
.pur-m-date-sum {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
}

/* 거래 카드 */
.pur-m-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
}
.pur-m-card:active { background: var(--color-row-zebra); }
.pur-m-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pur-m-card-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
/* SKU 영역 — 카드 안 */
.pur-m-card-sku {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.pur-m-card-thumb {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--color-primary-bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: var(--color-text-muted);
}
.pur-m-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pur-m-card-sku-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pur-m-card-sku-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pur-m-card-sku-brand {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-bg);
  border: 1px solid var(--color-primary-border);
  padding: 2px 8px;
  border-radius: 9px;
}
.pur-m-card-sku-code {
  font-family: ui-monospace, 'SF Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.2px;
}
/* 품명 — 진한 본문색 + 줄바꿈 허용 (모바일 카드는 가로 좁아서 잘림 방지) */
.pur-m-card-sku-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

/* 카드 하단 — 결제수단 + 매입처 + 금액 */
.pur-m-card-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.pur-m-card-pay {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--color-text-dim);
  flex-shrink: 0;
}
.pur-m-card-sup {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pur-m-card-amount {
  margin-left: auto;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}
.pur-m-card-amount.income { color: var(--color-success); }
.pur-m-card-qty {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* 카테고리 뱃지 (카드, 즐겨찾기) */
.pur-m-cat-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9px;
  white-space: nowrap;
  flex-shrink: 0;
}
.pur-m-cat-badge.cat-purchase { background: var(--color-primary-bg);   color: var(--color-primary-hover); border: 1px solid var(--color-primary-border); }
.pur-m-cat-badge.cat-supplies { background: var(--color-info-bg);      color: var(--color-info);          border: 1px solid #bfdbfe; }
.pur-m-cat-badge.cat-fixed    { background: var(--color-warning-bg);   color: var(--color-warning);       border: 1px solid #fde68a; }
.pur-m-cat-badge.cat-etc      { background: #f1f5f9;                   color: var(--color-text-dim);      border: 1px solid var(--color-border-strong); }
.pur-m-cat-badge.cat-income   { background: var(--color-success-bg);   color: var(--color-success);       border: 1px solid #a7f3d0; }

/* ============================================
   풀스크린 편집 모달
   ============================================ */
.pur-m-modal {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* 어떤 자식도 viewport 가로폭을 넘어가지 못하게 차단 — 좌우 스크롤 방지 */
  max-width: 100vw;
}
.pur-m-modal *,
.pur-m-modal *::before,
.pur-m-modal *::after { box-sizing: border-box; }
.pur-m-modal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.pur-m-modal-close {
  width: 32px; height: 32px;
  background: none;
  border: none;
  color: var(--color-text-dim);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
}
.pur-m-modal-close:active { background: var(--color-primary-bg); }
.pur-m-modal-spacer { width: 32px; flex-shrink: 0; }
.pur-m-modal-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pur-m-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
}
.pur-m-modal-body > * { max-width: 100%; min-width: 0; }

/* 필드 공통 */
.pur-m-field { display: flex; flex-direction: column; gap: 5px; }
.pur-m-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0.2px;
}
.pur-m-field-input {
  width: 100%;
  max-width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  outline: none;
  box-sizing: border-box;
  min-width: 0;
}
.pur-m-field-input:focus { border-color: var(--color-primary); }
.pur-m-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pur-m-field-row .pur-m-field { gap: 5px; }

.pur-m-unit-price-hint {
  font-size: 11px;
  color: var(--color-text-secondary);
  text-align: right;
  margin-top: -8px;
}

/* 카테고리 칩 (편집 모달 안) */
.pur-m-cat-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pur-m-cat-chip {
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text-dim);
  cursor: pointer;
}
.pur-m-cat-chip.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* 결제수단 segmented */
.pur-m-seg {
  display: flex;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
}
.pur-m-seg-btn {
  flex: 1;
  padding: 10px 8px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-dim);
  cursor: pointer;
  border-right: 1px solid var(--color-border);
}
.pur-m-seg-btn:last-child { border-right: none; }
.pur-m-seg-btn.active {
  background: var(--color-primary);
  color: #fff;
}

/* SKU/매입처 picker 버튼 */
.pur-m-picker-btn {
  width: 100%;
  max-width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--color-text);
  box-sizing: border-box;
  overflow: hidden;
}
.pur-m-picker-btn:active { background: var(--color-primary-bg); }
.pur-m-picker-thumb {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--color-primary-bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: var(--color-text-muted);
}
.pur-m-picker-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pur-m-picker-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
/* picker 텍스트: 위 줄(브랜드+SKU), 아래 줄(품명) — 카드와 동일 톤 */
.pur-m-picker-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pur-m-picker-brand {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-bg);
  border: 1px solid var(--color-primary-border);
  padding: 2px 8px;
  border-radius: 9px;
}
.pur-m-picker-sku {
  font-family: ui-monospace, 'SF Mono', 'SFMono-Regular', Menlo, Monaco, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.2px;
}
.pur-m-picker-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.pur-m-picker-placeholder {
  flex: 1;
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* 매입처 pill (편집 모달 + 카드) */
.pur-m-supplier-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 편집 모달 푸터 */
.pur-m-modal-footer {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}
.pur-m-footer-btn {
  flex: 1;
  height: 44px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.pur-m-footer-btn:active { background: var(--color-primary-bg); }
.pur-m-footer-done {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.pur-m-footer-done:active { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.pur-m-footer-del {
  color: var(--color-danger);
  border-color: #fecaca;
}
.pur-m-footer-del:active { background: var(--color-danger-bg); }

/* ============================================
   SKU / 매입처 / 즐겨찾기 picker 풀스크린 모달
   ============================================ */
.pur-m-picker-modal {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pur-m-picker-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.pur-m-picker-search-input {
  flex: 1;
  height: 36px;
  padding: 0 4px;
  border: none;
  font-size: 14px;
  outline: none;
  background: transparent;
}
.pur-m-picker-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0;
}
.pur-m-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
}
.pur-m-picker-item:active { background: var(--color-primary-bg); }
.pur-m-picker-create {
  color: var(--color-primary);
  font-weight: 600;
  font-size: 13px;
  background: var(--color-primary-bg);
}
.pur-m-picker-stock {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.pur-m-picker-stock.ok { color: var(--color-success); }
.pur-m-picker-stock.low { color: var(--color-danger); }
.pur-m-picker-stock.warn { color: var(--color-warning); }
.pur-m-picker-stock.zero { color: var(--color-text-secondary); }
.pur-m-picker-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────────
   SourcingPage — HTML 그룹 행 + 마켓 토글 (Handsontable 없음)
   ───────────────────────────────────────────────────────────── */

.src-page {
  padding: 20px 24px 0; /* 주문관리와 동일 여백 (형 7/17) */
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--color-bg);
}

.src-page.src-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--color-bg);
  padding: 16px;
}
body.src-fs-active .app-content { z-index: auto; }

/* 소싱 페이지만 좌우 여백 축소 (24→10px) — 시트 가로 공간 확보 (2026-08-04 형 지시). PC 전용. */
@media (min-width: 1025px) {
  body.src-wide .app-content { padding-left: 10px; padding-right: 10px; }
  /* 시트만 추가 확장 — 탭·검색창 툴바 줄은 페이지 여백(24px) 유지, 시트가 여백을 뚫고 좌우 16px 더 나감.
     전체화면 모드는 자체 여백 구조라 제외. */
  .src-page:not(.src-fullscreen) .src-sheet-wrap { margin-left: -16px; margin-right: -16px; }
}

/* 메인 탭 */
.src-main-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}
.src-main-tab {
  background: none;
  border: none;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}
.src-main-tab:hover { color: var(--color-text); }
.src-main-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 700;
}

/* 마켓플레이스 토글 바 */
.src-mp-bar {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.src-mp-loading { font-size: 12px; color: var(--color-text-secondary); }
.src-mp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 2px solid var(--color-border);
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all 0.12s ease;
  font-family: inherit;
}
.src-mp-btn:hover {
  border-color: var(--color-text-secondary);
  color: var(--color-text);
}
.src-mp-btn.active {
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.src-mp-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.src-mp-countries {
  font-size: 11px;
  color: var(--color-text-dim);
  font-weight: 500;
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1px solid var(--color-border);
}

/* 툴바 */
.src-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.src-search {
  padding: 7px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: var(--color-text);
  width: 240px;
  outline: none;
  font-family: inherit;
}
.src-search:focus { border-color: var(--color-primary); }
.src-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--color-text);
  user-select: none;
}
.src-toggle-track {
  width: 32px; height: 18px;
  background: #d4d4d4;
  border-radius: 9px;
  position: relative;
  transition: background 0.15s;
}
.src-toggle-track::before {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}
.src-toggle-track.on { background: var(--color-primary); }
.src-toggle-track.on::before { transform: translateX(14px); }

.src-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--color-text);
  font-weight: 500;
  font-family: inherit;
  outline: none;
}
.src-btn:hover:not(:disabled) { border-color: var(--color-primary); }
.src-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.src-btn.primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.src-btn.primary:hover { background: var(--color-primary-hover); }
.src-btn.toggled {
  background: #fff;
  border-color: var(--color-primary);
  box-shadow: var(--pf-ring);
  font-weight: 700;
  color: var(--color-text);
}
.src-btn.danger {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
  font-weight: 700;
}
.src-btn.danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
.src-btn svg { width: 14px; height: 14px; }
/* 삭제 / 재고등록 — 카운트 (최대 4자리) 들어와도 폭 안 변하게 고정 */
.src-btn-fixed { min-width: 130px; justify-content: center; }

.src-sep { width: 1px; height: 22px; background: var(--color-border); margin: 0 4px; }
.src-spacer { flex: 1; }

.src-rates {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}
.src-rate-label { font-size: 11px; color: var(--color-text-secondary); font-weight: 600; }
.src-rate {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--color-bg);
  color: var(--color-text-dim);
  cursor: pointer;
  font-weight: 500;
}
.src-rate:hover { background: var(--color-primary-bg); }
.src-rate strong { color: var(--color-text); margin-left: 3px; font-weight: 700; }

.src-next-sku {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 10px;
  color: #78350f;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}
.src-next-sku svg { color: #d97706; flex-shrink: 0; }
.src-next-sku-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #92400e;
}
.src-next-sku strong {
  font-size: 19px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #b45309;
  letter-spacing: 0.5px;
  font-family: ui-monospace, monospace;
}

/* 그룹 리스트 */
.src-group-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.src-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 14px;
  background: #fff;
  border-radius: 12px;
  border: 1px dashed var(--color-border);
}

/* ─────────────────────────────────────────────────────────────
   HTML <table> 시트 — 브라우저 native 정렬 사용.
   table-layout: fixed + <colgroup> width 로 픽셀 정확 정렬.
   ───────────────────────────────────────────────────────────── */
.src-sheet-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding-right: 4px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  color: #0f172a;
}

/* 각 그룹 카드 — 독립적 카드 모양 */
.group-card {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
  transition: box-shadow 0.12s, border-color 0.12s;
  contain: layout style; /* 그룹 카드 내부 layout 변화가 외부로 전파 안 되게. expand/collapse 시 layout 비용 절감. */
}
.group-card:hover { border-color: #94a3b8; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }
.group-card.open {
  border-color: var(--color-primary, #6366f1);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

/* 메타 행 (접힌 상태 = 이것만 보임) */
.group-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background: #f8fafc;
  border-bottom: 1px solid transparent;
  min-height: 52px;
  box-sizing: border-box;
}
.group-meta:hover { background: var(--color-primary-bg, #eef2ff); }
.group-card.open .group-meta {
  background: var(--color-primary, #6366f1);
  color: #fff;
  border-bottom-color: var(--color-primary, #4f46e5);
}
.meta-toggle { font-size: 11px; color: var(--color-primary-hover, #4338ca); font-weight: 700; width: 14px; flex-shrink: 0; }
.group-card.open .meta-toggle { color: #fff; }
.group-meta input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; margin: 0; }
.meta-prefix {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-primary-hover, #4338ca);
  font-family: ui-monospace, monospace;
  letter-spacing: 0.4px;
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
}
.group-card.open .meta-prefix { color: #fff; }
.meta-prefix.editable { cursor: text; }
.meta-prefix-ph {
  color: var(--color-text-muted);
  font-style: italic;
  font-weight: 500;
  font-size: 14px;
}
.group-card.open .meta-prefix-ph { color: rgba(255,255,255,0.7); }
.meta-prefix.editable:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--color-border-strong);
}
.group-card.open .meta-prefix.editable:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.5);
}
.meta-prefix-input {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-primary-hover, #4338ca);
  font-family: ui-monospace, monospace;
  letter-spacing: 0.4px;
  padding: 2px 6px;
  border: 1.5px solid var(--color-primary);
  border-radius: 4px;
  outline: none;
  background: #fff;
  width: 90px;
  box-sizing: border-box;
}
.meta-brand {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  flex-shrink: 0;
  cursor: text;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
}
.meta-brand:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--color-border-strong);
}
.meta-brand.readonly {
  cursor: default;
  border-color: transparent;
}
.meta-brand.readonly:hover {
  background: transparent;
  border-color: transparent;
}
.meta-brand-ph { color: var(--color-text-muted); font-style: italic; font-weight: 400; }
.group-card.open .meta-brand { color: #fff; }
.group-card.open .meta-brand:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.4); }
.meta-brand-input {
  font-size: 14px;
  color: #0f172a;
  font-weight: 600;
  padding: 4px 8px;
  border: 1.5px solid var(--color-primary);
  border-radius: 4px;
  outline: none;
  font-family: inherit;
  background: #fff;
  width: 180px;
  box-sizing: border-box;
}
.meta-count {
  font-size: 11px;
  background: var(--color-primary, #6366f1);
  color: #fff;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}
.group-card.open .meta-count {
  background: #fff;
  color: var(--color-primary-hover, #4338ca);
}
.meta-reg {
  font-size: 11px;
  background: #d1fae5;
  color: #065f46;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
/* 마진 개선됨 배지 — 마진필터에서 가격 고쳐 임계값 위로 올라간 그룹 */
.meta-improved {
  font-size: 11px;
  background: #dcfce7;
  color: #15803d;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 700;
  border: 1px solid #86efac;
  flex-shrink: 0;
}
.meta-add-btn {
  margin-left: auto;
  background: #fff;
  border: 1px solid var(--color-primary, #6366f1);
  color: var(--color-primary-hover, #4338ca);
  padding: 5px 12px;
  font-size: 11px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}
.meta-add-btn:hover { background: var(--color-primary-hover, #4338ca); color: #fff; }
.group-card.open .meta-add-btn { background: #fff; color: var(--color-primary-hover, #4338ca); }

/* 펼친 카드 안의 자체 table — 매입 페이지 스타일 차용 */
.group-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}
.group-table thead th {
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  background: #fafbfd;
  border-bottom: 1px solid var(--color-border-strong);
  border-right: 1px solid var(--color-border);
  white-space: nowrap;
  text-align: center;
  position: relative;
  user-select: none;
  height: 24px;
  box-sizing: border-box;
}
.group-table thead .th-name { text-align: left; padding-left: 12px; }
.group-table thead th:last-child { border-right: none; }
.th-name { padding-left: 12px !important; }
.th-country { font-size: 13px; font-weight: 700; color: var(--color-text); }
.th-sub { font-size: 10px; color: var(--color-text-secondary); font-weight: 500; margin-top: 1px; }

/* 일괄 입력 아이콘 버튼 */
.bulk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  color: var(--color-text-secondary);
  padding: 0;
  flex-shrink: 0;
}
.bulk-btn:hover {
  background: var(--color-primary-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.bulk-btn svg { width: 12px; height: 12px; pointer-events: none; }

/* 컬럼 리사이즈 핸들 — 매입 페이지와 동일 */
.col-resize {
  position: absolute; top: 0; right: 0; width: 6px; height: 100%;
  cursor: col-resize; user-select: none;
}
.col-resize:hover { background: rgba(99, 102, 241, 0.25); }
.col-resize:active { background: rgba(99, 102, 241, 0.5); }

/* TR — 옵션 행 */
.tr-variant {
  background: #fff;
}
.tr-variant:hover { background: #fafbfc; }
.tr-variant.checked { background: var(--color-primary-bg, #eef2ff); }
.tr-variant.sel { background: #fef9c3; }

.tr-variant td {
  border-right: 1px solid var(--color-border);
  border-bottom: 2px solid var(--color-border-strong); /* 옵션 행 사이 두꺼운 구분선 */
  padding: 0;
  vertical-align: middle;
  font-size: 13px;
  overflow: hidden;
  box-sizing: border-box;
  max-width: 0; /* table-layout:fixed 와 함께 — 콘텐츠가 컬럼 폭 밀어내지 않게. */
  height: 38px; /* 모드 무관 행 고정 — 시트 안 흔들림. */
}
.tr-variant:last-child td { border-bottom: none; } /* 마지막 옵션은 그룹 카드 보더가 처리 */
.group-table { table-layout: fixed !important; }
.tr-variant td:last-child { border-right: none; }
.td-chk { padding: 0 4px !important; text-align: center; }
.td-chk input { width: 15px; height: 15px; cursor: pointer; margin: 0; vertical-align: middle; }
.td-act {
  text-align: center;
  white-space: nowrap;
  padding: 0 6px !important;
}

/* hover/checked/sel — td 단위로 적용 (행 호버 시 셀 배경 변경) */
.tr-variant:hover > td { background: var(--color-primary-bg); }
.tr-variant.checked > td { background: var(--color-primary-bg, #eef2ff); }
.tr-variant.sel > td { background: #fef9c3; }

/* ─── EditCell ─── 구글 시트 방식: display 가 셀 100% 차지. input 도 동일 위치/크기. */
.edit-display {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;          /* 칸(td) 높이에 맞춤 — 국가칸 2단으로 행이 커져도 꽉 참 (2026-08-13 형 지적) */
  min-height: 38px;
  padding: 0 8px;
  cursor: text;
  font-size: 13px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  outline: none;
}
.edit-display.left { justify-content: flex-start; }
.edit-display:hover { background: var(--pf-hover, var(--color-primary-bg, #f1f5f9)); }   /* 호버=사다리 15% 규격, 인디고 하드코딩 제거 (2026-08-13) */
/* 셀 선택 (2026-08-13 형 지시) — 칸(td) 전체를 감싸는 선택 박스. 색 = 브랜드 변수만 (인디고 하드코딩 금지).
   :has() = 그 칸 안의 셀(표시/입력)이 포커스일 때 td 전체에 테두리·배경. */
.edit-display:focus { outline: none; }
.group-card td.cell-focused {
  position: relative;
  background: var(--color-primary-bg, #f1f5f9);
}
/* 테두리는 칸 맨 위 투명 덮개(::after)에 — 호버 칠·입력창(중간층)이 테두리를 못 덮음. 클릭은 통과(pointer-events:none) */
.group-card td.cell-focused::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 2px solid var(--color-primary);
  pointer-events: none;
  z-index: 3;
}
/* 범위 선택 (드래그 / Shift+클릭) 하이라이트 — Ctrl+C 복사 대상 */
.group-card td.cell-range-sel {
  position: relative;
  background: var(--color-primary-bg, #f1f5f9);   /* 안쪽 칸 = 칠만 */
}
/* 범위 둘레 2px 테두리 — 가장자리 변만, 역시 천장(::after) 덮개에 그림 */
.group-card td.cell-range-sel::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 3;
}
.group-card td.rs-t::after { border-top: 2px solid var(--color-primary); }
.group-card td.rs-b::after { border-bottom: 2px solid var(--color-primary); }
.group-card td.rs-l::after { border-left: 2px solid var(--color-primary); }
.group-card td.rs-r::after { border-right: 2px solid var(--color-primary); }
/* 드래그 중 글자 선택 방지 */
body.src-dragging { user-select: none; }
.edit-display-num .edit-val {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.edit-val {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  max-width: 100%;
}
.edit-aff { color: var(--color-text); font-weight: 700; font-size: 13px; }
.edit-ph { color: #cbd5e1; font-size: 12px; font-style: italic; font-weight: 400; }
.c-price .edit-val { color: #dc2626; font-weight: 700; }

/* 편집 input — 구글 시트처럼 셀 영역 100% 차지. 시트가 흔들리지 않음. */
.edit-input {
  display: block;
  width: 100%;
  height: 100%;          /* 칸 꽉 채움 — 위아래 띠 제거 (2026-08-13 형 지적) */
  min-height: 38px;
  padding: 0 8px;
  margin: 0;
  border: none;          /* 테두리는 칸(td:has focus) 하나만 — 2겹 해결 */
  outline: none;
  border-radius: 0;
  font-size: 13px;
  outline: none;
  background: #fff;
  box-sizing: border-box;
  font-family: inherit;
  color: var(--color-text);
  text-align: center;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.18);
}
.edit-input.left { text-align: left; }
.edit-input-num { text-align: right; font-variant-numeric: tabular-nums; }
.edit-input::-webkit-outer-spin-button,
.edit-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.edit-input[type=number] { -moz-appearance: textfield; }

/* 국가 색상 (좌측 보더 + 옅은 배경) */
.tint-sg { border-left: 3px solid #10b981 !important; background: #f0fdf4; }
.tint-tw { border-left: 3px solid #3b82f6 !important; background: #eff6ff; }
.tint-th { border-left: 3px solid #f59e0b !important; background: #fffbeb; }
.tint-my { border-left: 3px solid #ef4444 !important; background: #fef2f2; }
.tint-ph { border-left: 3px solid #8b5cf6 !important; background: #f5f3ff; }
.tint-id { border-left: 3px solid #ec4899 !important; background: #fdf2f8; }
.tint-jp { border-left: 3px solid #f43f5e !important; background: #fff1f2; }
.tint-us { border-left: 3px solid #14b8a6 !important; background: #f0fdfa; }

/* 가격 셀 — 2x2 grid: [LVG | 판매가] / [마진₩ | 마진%] */
.pg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 32px 28px;
  width: 100%;
  height: 100%;
}
.pg-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border-bottom: 1px solid var(--color-border-strong);
  font-size: 12px;
  box-sizing: border-box;
  overflow: hidden;
  justify-content: center;
}
/* 우측 보더 — 좌측 셀에만 (input, margin). 우측 셀 (derived, pct) 은 보더 없음 */
.pg-input { border-right: 1px solid var(--color-border-strong); }
.pg-derived { border-right: none; }
.pg-margin { border-right: 1px solid var(--color-border-strong); }
.pg-pct { border-right: none; }
/* 아래 두 셀 (margin / pct) — 하단 보더 제거 */
.pg-margin, .pg-pct { border-bottom: none; }
/* TW: input 이 윗줄 통째 차지, 우측 보더 X */
.pg-span2 {
  grid-column: 1 / -1 !important;
  border-right: none !important;
}
.pg-val {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 6px;
}
.pg-val.pos { color: #059669; }
.pg-val.neg { color: #dc2626; }
/* 괄호 병기 — 부가세환급 제외 마진금. 본 숫자보다 한 단계 작게, 배경 없이 글자색만. */
.pg-val-x {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  padding-right: 4px;
}
/* 환급전 괄호 색 규칙 (형 확정 8/5): 환급전 이익률 5%↑ = 회색(조용) / 5% 미만 = 진한 빨강(경보).
   마진금·이익률 괄호 공통. background none = 전역 .mr-* 배경 규칙 잔재 방지. */
.pg-val-x.xv-gray, .pg-pct-x.xv-gray { color: var(--color-text-secondary); background: none; }
.pg-val-x.xv-red, .pg-pct-x.xv-red { color: #b91c1c; font-weight: 800; background: none; }

/* 입력 셀 안 EditCell — 셀 100% 차지. LVG/판매가 텍스트 강조 (다른 셀보다 큼). */
.pg-input { padding: 0; }
.pg-input .edit-display { height: 100%; padding: 0 6px; font-size: 14px; font-weight: 700; }
.pg-input .edit-input { height: 100%; padding: 0 6px; font-size: 14px; font-weight: 700; }
.pg-input .edit-val { font-size: 14px !important; font-weight: 700; }
.pg-input .edit-aff { font-size: 13px; }
.pg-input .c-price .edit-val { color: #dc2626; font-weight: 700; }

.pg-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  flex-shrink: 0;
  margin: 0 auto;
  min-width: 44px;
}
.pg-pct { justify-content: center; }
/* pill 옆에 환급전 괄호가 설 때 auto 마진이 간격을 흡수하지 않게 — 센터링은 pg-cell 의 justify-content 가 담당 */
.pg-pct .pg-pill, .pg-margin .pg-pill { margin: 0; }
/* 괄호 병기 — 환급전 이익률. pill 아님(본 이익률 pill 과 구분), 색은 위 xv-gray/xv-red 공통 규칙 */
.pg-pct-x {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
/* 마진금 pill — 이익률 pill 과 같은 규격, 금액이 길어 넘칠 때만 말줄임 */
.pg-pill-amt { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pg-pill.mr-grn { background: #d1fae5; color: #065f46; }
.pg-pill.mr-blu { background: #dbeafe; color: #1e40af; }
.pg-pill.mr-org { background: #fed7aa; color: #9a3412; }
.pg-pill.mr-red { background: #fecaca; color: #991b1b; }

/* 마진 pill 색상 (테이블 안에서도 같이 적용) */
.ps-pill.mr-grn, .sv-pill.mr-grn, .mr-pill.mr-grn { background: #d1fae5; color: #065f46; }
.ps-pill.mr-blu, .sv-pill.mr-blu, .mr-pill.mr-blu { background: #dbeafe; color: #1e40af; }
.ps-pill.mr-org, .sv-pill.mr-org, .mr-pill.mr-org { background: #fed7aa; color: #9a3412; }
.ps-pill.mr-red, .sv-pill.mr-red, .mr-pill.mr-red { background: #fecaca; color: #991b1b; }

/* 액션 버튼 */
.td-act-btn {
  background: none;
  border: 1px solid transparent;
  color: #64748b;
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0 1px;
}
.td-act-btn:hover { border-color: #cbd5e1; color: var(--color-primary, #6366f1); background: #fff; }
.td-act-btn.danger:hover { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.td-reg { color: #10b981; font-size: 14px; margin-right: 4px; }

/* ─────────────────────────────────────────────────────────────
   레거시 sv-* 셀렉터 (안 쓰지만 충돌 방지용 placeholder)
   ───────────────────────────────────────────────────────────── */
:root {
  --sv-col-chk: 36px;
  --sv-col-sku: 96px;
  --sv-col-name: minmax(220px, 1fr);
  --sv-col-cost: 96px;
  --sv-col-weight: 72px;
  --sv-col-price: 230px;
  --sv-col-act: 72px;
}

/* 1국가 (Q10, eBay) */
.sv-group .sv-row, .sv-group .sv-row-head, .sv-group .sv-meta-row {
  --sv-cols: var(--sv-col-chk) var(--sv-col-sku) var(--sv-col-name) var(--sv-col-cost) var(--sv-col-weight) var(--sv-col-price) var(--sv-col-act);
}
/* 4국가 (Shopee) */
.sv-group[data-cc="4"] .sv-row, .sv-group[data-cc="4"] .sv-row-head, .sv-group[data-cc="4"] .sv-meta-row {
  --sv-cols: var(--sv-col-chk) var(--sv-col-sku) var(--sv-col-name) var(--sv-col-cost) var(--sv-col-weight) var(--sv-col-price) var(--sv-col-price) var(--sv-col-price) var(--sv-col-price) var(--sv-col-act);
}
/* 5국가 (Lazada) */
.sv-group[data-cc="5"] .sv-row, .sv-group[data-cc="5"] .sv-row-head, .sv-group[data-cc="5"] .sv-meta-row {
  --sv-cols: var(--sv-col-chk) var(--sv-col-sku) var(--sv-col-name) var(--sv-col-cost) var(--sv-col-weight) var(--sv-col-price) var(--sv-col-price) var(--sv-col-price) var(--sv-col-price) var(--sv-col-price) var(--sv-col-act);
}

/* 메타 행 — 그리드 컬럼 사용. 데이터 셀들은 빈 spacer 로 점유. */
.sv-meta-row {
  display: grid;
  grid-template-columns: var(--sv-cols, 36px 96px minmax(220px, 1fr) 96px 72px 230px 230px 230px 230px 72px);
  background: var(--color-primary-bg, #eef2ff);
  border-bottom: 2px solid var(--color-primary-border, #c7d2fe);
  min-height: 44px;
  cursor: pointer;
  user-select: none;
}
.sv-meta-row:hover { background: var(--color-primary-bg, #e0e7ff); }
.sv-group.open .sv-meta-row { background: var(--color-primary, #6366f1); color: #fff; }
.sv-group.open .sv-meta-row .sv-cell { color: #fff; }
.sv-meta-prefix {
  font-size: 16px !important;
  font-weight: 800 !important;
  color: var(--color-primary-hover, #4338ca) !important;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sv-group.open .sv-meta-prefix { color: #fff !important; }
.sv-toggle-icon { font-size: 10px; color: var(--color-primary, #6366f1); }
.sv-group.open .sv-toggle-icon { color: #fff; }
.sv-meta-brand {
  justify-content: flex-start !important;
  gap: 10px;
  padding: 0 10px !important;
}
.sv-meta-brand strong { font-size: 13px; font-weight: 700; }
.sv-meta-count {
  font-size: 11px;
  background: var(--color-primary, #6366f1);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}
.sv-group.open .sv-meta-count {
  background: #fff;
  color: var(--color-primary-hover, #4338ca);
}
.sv-meta-reg {
  font-size: 11px;
  background: #d1fae5;
  color: #065f46;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}
.sv-meta-spacer {
  border-right: none !important;
}
.sv-meta-add {
  background: #fff;
  border: 1px solid var(--color-primary, #6366f1);
  color: var(--color-primary-hover, #4338ca);
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  white-space: nowrap;
}
.sv-meta-add:hover { background: var(--color-primary-hover, #4338ca); color: #fff; }
.sv-group.open .sv-meta-add { background: #fff; color: var(--color-primary-hover, #4338ca); border-color: #fff; }

.sv-group {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.sv-group:hover { border-color: #94a3b8; }
.sv-group.open {
  border-color: var(--color-primary, #6366f1);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

/* 그룹 헤더 — 데이터까지 한 줄에 들어가야 해서 충분히 크게 */
.sv-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  background: #f8fafc;
  border-bottom: 1px solid transparent;
  font-size: 13px;
  min-height: 56px;
  box-sizing: border-box;
  flex-wrap: nowrap;
}
.sv-group.open .sv-group-header {
  background: var(--color-primary-bg, #eef2ff);
  border-bottom-color: var(--color-primary-border, #c7d2fe);
}
.sv-group-header:hover { background: var(--color-primary-bg, #eef2ff); }
.sv-group-toggle {
  font-size: 10px;
  color: var(--color-primary, #6366f1);
  width: 12px;
  font-weight: 700;
}
.sv-group-header input[type=checkbox] { width: 14px; height: 14px; cursor: pointer; }
.sv-group-prefix {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-primary-hover, #4338ca);
  font-family: ui-monospace, monospace;
  letter-spacing: 0.4px;
  min-width: 52px;
}
.sv-group-brand {
  font-size: 14px;
  color: #0f172a;
  font-weight: 600;
}
.sv-group-count {
  font-size: 11px;
  color: #fff;
  background: var(--color-primary, #6366f1);
  padding: 3px 9px;
  border-radius: 10px;
  font-weight: 700;
}
.sv-group-count::after { content: '개 옵션'; margin-left: 2px; font-weight: 600; }
.sv-group-reg {
  font-size: 11px;
  background: #d1fae5;
  color: #065f46;
  padding: 3px 9px;
  border-radius: 10px;
  font-weight: 700;
}
.sv-group-add {
  margin-left: auto;
  background: #fff;
  border: 1px solid #cbd5e1;
  padding: 5px 11px;
  font-size: 11px;
  border-radius: 6px;
  cursor: pointer;
  color: #475569;
  font-weight: 600;
  font-family: inherit;
  flex-shrink: 0;
}
.sv-group-add:hover { border-color: var(--color-primary, #6366f1); color: var(--color-primary, #6366f1); background: var(--color-primary-bg, #eef2ff); }

/* 접힌 그룹 헤더에 박혀있는 미리보기 — 첫 옵션의 SKU/품명/원가/중량/국가별 가격·마진 */
.sv-group-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  margin-left: 14px;
  overflow: hidden;
}
.sv-group-mini-sku {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}
.sv-group-mini-name {
  font-size: 12px;
  color: #0f172a;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
  flex-shrink: 0;
}
.sv-group-mini-cost {
  font-size: 11px;
  color: #475569;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  flex-shrink: 0;
}
.sv-group-mini-weight {
  font-size: 11px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.sv-group-mini-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  border-left: 3px solid;
}
.sv-group-mini-price.tint-sg { border-left-color: #10b981; background: #f0fdf4; }
.sv-group-mini-price.tint-tw { border-left-color: #3b82f6; background: #eff6ff; }
.sv-group-mini-price.tint-th { border-left-color: #f59e0b; background: #fffbeb; }
.sv-group-mini-price.tint-my { border-left-color: #ef4444; background: #fef2f2; }
.sv-group-mini-price.tint-ph { border-left-color: #8b5cf6; background: #f5f3ff; }
.sv-group-mini-price.tint-id { border-left-color: #ec4899; background: #fdf2f8; }
.sv-group-mini-price.tint-jp { border-left-color: #f43f5e; background: #fff1f2; }
.sv-group-mini-price.tint-us { border-left-color: #14b8a6; background: #f0fdfa; }
.sv-group-mini-price b { font-weight: 800; color: #0f172a; }
.sv-group-mini-pval { color: #334155; font-weight: 600; }
.sv-pill.mini { font-size: 9px; padding: 1px 5px; min-width: 32px; }

/* variant 행 영역 */
.sv-rows { background: #fff; }

.sv-row, .sv-row-head {
  display: grid;
  grid-template-columns: var(--sv-cols, 36px 96px minmax(220px, 1fr) 96px 72px 230px 230px 230px 230px 72px);
  align-items: stretch;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
  color: #0f172a;
  min-height: 60px;
}
.sv-row:last-child { border-bottom: none; }
.sv-row:hover { background: #fafbfc; }
.sv-row.checked { background: var(--color-primary-bg, #eef2ff); }
.sv-row.sel { background: #fef9c3; }

.sv-row-head {
  background: #f1f5f9;
  border-bottom: 2px solid #94a3b8;
  font-weight: 700;
  font-size: 11px;
  color: #475569;
  letter-spacing: 0.3px;
  height: 34px;
  min-height: 34px;
}

.sv-cell {
  display: flex;
  align-items: center;
  justify-content: center; /* 디폴트 중앙정렬 */
  text-align: center;
  padding: 0 6px;
  border-right: 1px solid #e2e8f0;
  overflow: hidden;
  box-sizing: border-box;
  gap: 4px;
}
.sv-row-head .sv-cell { border-right: 1px solid #cbd5e1; }
.sv-cell:last-child { border-right: none; }

.sv-c-chk input { width: 15px; height: 15px; cursor: pointer; margin: 0; }
.sv-c-sku {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
/* 품명만 좌측정렬 */
.sv-c-name {
  justify-content: flex-start;
  text-align: left;
  padding: 0 8px;
}
.sv-c-cost, .sv-c-weight {
  padding: 0 6px;
  gap: 2px;
}
.sv-c-act { gap: 4px; padding: 0 8px; }

/* 통화·단위 표시 */
.sv-unit-pre, .sv-unit-post {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  flex-shrink: 0;
}

/* 인풋 — 셀처럼 보이게. focus 시만 윤곽 강조 */
.sv-in {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  font-size: 12px;
  color: #0f172a;
  font-family: inherit;
  outline: none;
  padding: 0 4px;
  box-sizing: border-box;
  text-align: center;
}
.sv-in-left { text-align: left; }
.sv-in:focus {
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--color-primary, #6366f1);
  border-radius: 3px;
}
.sv-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* number input 화살표 제거 */
input.sv-num::-webkit-outer-spin-button,
input.sv-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input.sv-num { -moz-appearance: textfield; }

.c-price { color: #dc2626; font-weight: 700; }

/* 가격 셀 내부 — 4개 칸 (LVG/판매가/마진₩/마진%) */
.sv-price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 50px;
  align-items: center;
  width: 100%;
  height: 100%;
  gap: 2px;
  padding: 4px 2px;
  box-sizing: border-box;
}
.sv-pc {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sv-pc-in {
  background: #fff;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  height: 26px;
  gap: 3px;
  padding: 0 4px;
}
.sv-pc-in input.sv-in { padding: 0; height: 100%; font-size: 12px; font-weight: 700; }
.sv-cur { font-size: 9px; color: #64748b; font-weight: 600; flex-shrink: 0; }
.sv-pc-derived {
  color: #475569;
  font-weight: 600;
  font-size: 11px;
}
.sv-derived-arrow { color: #94a3b8; margin-right: 2px; font-weight: 700; }
.sv-derived-na { color: #94a3b8; font-style: italic; font-size: 10px; }
.sv-pc-margin {
  font-weight: 700;
  font-size: 11px;
}
.sv-pc-margin.pos { color: #059669; }
.sv-pc-margin.neg { color: #dc2626; }
.sv-pc-pill { padding-right: 2px; }

/* 국가 컬럼 — 진한 색 구분 (좌측 보더 + 옅은 배경) */
.sv-tint-sg { border-left: 3px solid #10b981; background: #f0fdf4; }
.sv-tint-tw { border-left: 3px solid #3b82f6; background: #eff6ff; }
.sv-tint-th { border-left: 3px solid #f59e0b; background: #fffbeb; }
.sv-tint-my { border-left: 3px solid #ef4444; background: #fef2f2; }
.sv-tint-ph { border-left: 3px solid #8b5cf6; background: #f5f3ff; }
.sv-tint-id { border-left: 3px solid #ec4899; background: #fdf2f8; }
.sv-tint-jp { border-left: 3px solid #f43f5e; background: #fff1f2; }
.sv-tint-us { border-left: 3px solid #14b8a6; background: #f0fdfa; }
.sv-row-head .sv-c-price { font-weight: 800; color: #0f172a; }

/* 마진 pill — 컴팩트 */
.sv-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: center;
  flex-shrink: 0;
}

/* 액션 버튼 */
.sv-act-btn {
  background: none;
  border: 1px solid transparent;
  color: #64748b;
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.sv-act-btn:hover { border-color: #cbd5e1; color: var(--color-primary, #6366f1); background: #fff; }
.sv-act-btn.danger:hover { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.sv-reg {
  color: #10b981;
  font-size: 14px;
  margin-right: 2px;
}

.src-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  min-height: 56px;
  transition: background 0.12s;
}
.src-group.open .src-group-header {
  background: var(--color-primary-bg);
  border-bottom: 1px solid var(--color-primary-border);
}
.src-group-header:hover { background: var(--pf-hover); }
.src-group-toggle {
  font-size: 12px;
  color: var(--color-text-secondary);
  width: 16px;
  flex-shrink: 0;
  font-weight: 700;
}
.src-group.open .src-group-toggle { color: var(--color-primary); }
.src-group-check { width: 17px; height: 17px; cursor: pointer; flex-shrink: 0; }
.src-group-prefix {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4px;
  min-width: 52px;
  font-family: ui-monospace, monospace;
}
.src-group-brand {
  font-size: 13px;
  color: var(--color-text);
  font-weight: 600;
  background: var(--color-bg);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
}
.src-group-preview {
  flex: 1;
  font-size: 12px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
  max-width: 280px;
}
.src-group-count {
  font-size: 11px;
  color: #fff;
  background: var(--color-primary);
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}
.src-group-reg-badge {
  font-size: 11px;
  background: #d1fae5;
  color: #065f46;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 700;
}

/* 접힘 상태 미리보기 행 — 그룹 카드 안에 첫 variant 요약 표시 */
.src-group-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 12px 50px;
  font-size: 12px;
  cursor: pointer;
  border-top: 1px dashed var(--color-border);
  flex-wrap: wrap;
}
.src-group-preview-row:hover { background: rgba(0, 0, 0, 0.02); }
.src-group-preview-sku {
  font-family: ui-monospace, monospace;
  font-weight: 700;
  font-size: 11px;
  color: var(--color-text);
  background: var(--color-bg);
  padding: 2px 8px;
  border-radius: 6px;
}
.src-group-preview-name {
  flex: 1;
  min-width: 180px;
  font-size: 12px;
  color: var(--color-text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.src-group-preview-meta {
  font-size: 11px;
  color: var(--color-text-secondary);
}
.src-group-preview-prices {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.src-group-preview-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}
.src-group-preview-price b {
  font-weight: 800;
  margin-right: 2px;
}
.mr-pill.mini {
  font-size: 10px;
  padding: 1px 6px;
  min-width: 36px;
}
.src-group-preview-more {
  font-size: 11px;
  color: var(--color-text-dim);
  font-style: italic;
}
.src-group-add-variant {
  margin-left: auto;
  background: none;
  border: 1px solid var(--color-border);
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--color-text-secondary);
  font-family: inherit;
  font-weight: 500;
}
.src-group-add-variant:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-bg);
}

.src-variant-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--color-border);
}
.src-variant {
  border-bottom: 1px solid #f0ede4;
  padding: 10px 14px;
  transition: background 0.1s;
}
.src-variant:last-child { border-bottom: none; }
.src-variant:hover { background: rgba(0, 0, 0, 0.012); }
.src-variant.checked { background: var(--color-primary-bg); }
.src-variant.sel { background: #fef9c3; }

.src-variant-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.src-variant-head > input[type=checkbox] {
  width: 15px; height: 15px; cursor: pointer; flex-shrink: 0;
}
.src-variant-sku {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  min-width: 72px;
  font-family: ui-monospace, monospace;
}
.src-variant-name {
  flex: 1;
  min-width: 200px;
  padding: 5px 10px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  color: var(--color-text);
  border-radius: 6px;
  outline: none;
  font-family: inherit;
}
.src-variant-name:hover { border-color: var(--color-border); background: #fff; }
.src-variant-name:focus { border-color: var(--color-primary); background: #fff; }

.src-field-label {
  font-size: 11px;
  color: var(--color-text-secondary);
  font-weight: 600;
  margin-left: 8px;
}
.src-variant-cost, .src-variant-weight {
  width: 76px;
  padding: 5px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  outline: none;
  font-family: inherit;
  background: #fff;
}
.src-variant-cost:focus, .src-variant-weight:focus { border-color: var(--color-primary); }
.src-unit { font-size: 10px; color: var(--color-text-secondary); margin-right: 4px; }
.src-badge.registered {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #d1fae5;
  color: #065f46;
  font-weight: 700;
}

/* 가격 행 (국가별) */
.src-variant-prices {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 80px;
}
.src-price-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}
.tint-sg { background: rgba(93, 202, 165, 0.08); }
.tint-tw { background: rgba(133, 183, 235, 0.08); }
.tint-th { background: rgba(250, 199, 117, 0.08); }
.tint-my { background: rgba(240, 153, 123, 0.08); }
.tint-ph { background: rgba(168, 162, 247, 0.08); }
.tint-id { background: rgba(252, 165, 165, 0.08); }
.tint-jp { background: rgba(251, 207, 232, 0.08); }
.tint-us { background: rgba(167, 243, 208, 0.08); }

.src-pr-country {
  font-size: 11px;
  font-weight: 800;
  color: var(--color-text);
  min-width: 28px;
}
.src-pr-label {
  font-size: 10px;
  color: var(--color-text-secondary);
  font-weight: 600;
  min-width: 36px;
}
.src-pr-input {
  width: 100px;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
  font-family: inherit;
  background: #fff;
}
.src-pr-input:focus { border-color: var(--color-primary); }
.src-pr-input.c-price { color: #dc2626; font-weight: 700; }
.src-pr-cur { font-size: 10px; color: var(--color-text-secondary); }
.src-pr-arrow { font-size: 12px; color: var(--color-text-dim); margin: 0 2px; }
.src-pr-derived {
  font-size: 12px;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  min-width: 90px;
  font-weight: 600;
}
.src-pr-margin {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 90px;
  text-align: right;
  font-weight: 600;
}
.src-pr-margin.c-mg { color: #059669; }
.src-pr-margin.c-mb { color: #dc2626; }

.mr-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: center;
}
.mr-grn { background: #d1fae5; color: #065f46; }
.mr-blu { background: #dbeafe; color: #1e40af; }
.mr-org { background: #fed7aa; color: #9a3412; }
.mr-red { background: #fecaca; color: #991b1b; }

.src-statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: var(--color-primary-bg);
  border-radius: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}
.src-statusbar-mp {
  margin-left: auto;
  font-weight: 700;
  color: var(--color-primary);
}

/* 컨텍스트 메뉴 */
.src-ctx-menu {
  position: fixed;
  z-index: 200;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  padding: 4px 0;
  min-width: 180px;
}
.src-ctx-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
}
.src-ctx-menu button:hover { background: var(--color-primary-bg); }
.src-ctx-sep { height: 1px; background: var(--color-border); margin: 4px 0; }

/* DetailPanel */
.src-detail-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.28);
  z-index: 1999;
  display: flex;
  justify-content: flex-end;
  animation: src-overlay-in 0.18s ease;
}
@keyframes src-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.src-detail-panel {
  position: relative;
  width: 420px;
  background: #fff;
  border-left: 1px solid var(--color-border);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: src-panel-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes src-panel-in {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.src-detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #ebe7d8; background: var(--color-bg);
  flex-shrink: 0;
}
.src-detail-title { display: flex; align-items: baseline; gap: 10px; }
.src-detail-sku { font-size: 16px; font-weight: 700; color: var(--color-text); }
.src-detail-grp {
  font-size: 11px; color: var(--color-primary); background: var(--color-primary-bg);
  padding: 2px 8px; border-radius: 10px; font-weight: 600;
}
.src-detail-close {
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--color-text-secondary); border-radius: 6px; display: flex;
}
.src-detail-close:hover { background: #f0ede4; color: var(--color-text); }
.src-detail-close svg { width: 18px; height: 18px; }
.src-detail-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.src-detail-product {
  background: var(--color-bg);
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
}
.src-detail-name { font-size: 14px; font-weight: 600; color: var(--color-text); margin-bottom: 4px; }
.src-detail-brand { font-size: 12px; color: var(--color-text-secondary); }
.src-detail-section { margin-bottom: 18px; }
.src-detail-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.src-detail-label-row label, .src-detail-label { font-size: 12px; color: var(--color-text); font-weight: 600; }
.src-group-btn {
  background: none; border: 1px solid var(--color-border); cursor: pointer;
  padding: 3px 8px; font-size: 10px; border-radius: 5px;
  color: var(--color-text-secondary); font-family: inherit; font-weight: 500;
}
.src-group-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.src-detail-input, .src-detail-textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--color-border);
  border-radius: 6px; font-size: 13px; color: var(--color-text); outline: none;
  font-family: inherit; background: #fff; box-sizing: border-box;
}
.src-detail-input:focus, .src-detail-textarea:focus { border-color: var(--color-primary); }
.src-detail-textarea { min-height: 80px; resize: vertical; }
.src-link-row { display: flex; gap: 6px; margin-bottom: 6px; }
.src-link-row input {
  flex: 1; padding: 6px 10px; border: 1px solid var(--color-border);
  border-radius: 5px; font-size: 12px; outline: none; font-family: inherit;
}
.src-link-row input:focus { border-color: var(--color-primary); }
.src-link-btn {
  background: none; border: 1px solid var(--color-border); cursor: pointer;
  padding: 4px 6px; border-radius: 5px; color: var(--color-text-secondary); display: flex;
}
.src-link-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.src-link-btn.del:hover { border-color: #dc2626; color: #dc2626; }
.src-link-btn svg { width: 13px; height: 13px; }
.src-link-add {
  background: none; border: 1px dashed var(--color-border); cursor: pointer;
  padding: 6px 10px; font-size: 11px; border-radius: 5px;
  color: var(--color-text-secondary); font-family: inherit; font-weight: 500; width: 100%;
}
.src-link-add:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* 수수료 모달 */
.src-modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3);
  z-index: 10000; display: flex; align-items: center; justify-content: center;
}
.src-modal {
  background: #fff; border-radius: 12px; width: 560px;
  max-width: 92vw; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.15);
}
.src-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #eee;
}
.src-modal-header h3 { font-size: 15px; font-weight: 700; color: var(--color-text); margin: 0; }
.src-modal-close {
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--color-text-secondary); border-radius: 6px; display: flex;
}
.src-modal-close:hover { background: var(--color-primary-bg); }
.src-modal-close svg { width: 18px; height: 18px; }
.src-modal-body { padding: 18px 20px; }
.src-fee-country { margin-bottom: 16px; }
.src-fee-country h4 { font-size: 13px; font-weight: 600; color: var(--color-text); margin: 0 0 10px; }
.src-fee-table { width: 100%; border-collapse: collapse; }
.src-fee-table th { padding: 6px 10px; font-size: 11px; color: var(--color-text-secondary); text-align: left; border-bottom: 1px solid #eee; background: var(--color-bg); font-weight: 600; }
.src-fee-table td { padding: 6px 10px; font-size: 12px; color: var(--color-text); border-bottom: 1px solid var(--color-border); }
.src-fee-input {
  width: 90px; padding: 4px 8px; border: 1px solid var(--color-border); border-radius: 6px;
  font-size: 12px; color: var(--color-text); text-align: right; font-family: inherit;
  font-variant-numeric: tabular-nums; outline: none; background: #fff;
}
.src-fee-input:focus { border-color: var(--color-primary); }
.src-modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 20px; border-top: 1px solid #eee; background: var(--color-bg);
  border-radius: 0 0 12px 12px;
}

/* 대량등록 */
.src-bulk-steps { display: flex; gap: 0; margin-bottom: 16px; }
.src-bulk-step { flex: 1; text-align: center; padding: 12px; background: var(--color-bg); border: 1px solid #eee; cursor: pointer; }
.src-bulk-step:first-child { border-radius: 8px 0 0 8px; }
.src-bulk-step:last-child { border-radius: 0 8px 8px 0; }
.src-bulk-step.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.src-bulk-step.done { background: #f0ede4; }
.src-bulk-step-num { font-size: 11px; font-weight: 700; margin-bottom: 2px; }
.src-bulk-step-label { font-size: 12px; font-weight: 500; }
.src-bulk-step.active .src-bulk-step-num,
.src-bulk-step.active .src-bulk-step-label { color: #fff; }
.src-bulk-content {
  background: #fff; border: 1px solid #eee; border-radius: 12px;
  padding: 24px; min-height: 200px;
}

/* 모바일 */
@media (max-width: 1024px) {
  .src-detail-panel { width: 360px; }
}
@media (max-width: 768px) {
  .src-page { padding: 12px; }
  .src-detail-overlay { align-items: flex-end; justify-content: stretch; }
  .src-detail-panel {
    width: 100%; max-width: 100%;
    height: 70vh;
    border-left: none; border-top: 1px solid var(--color-border);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
  }
  .src-rates { display: none; }
  .src-toolbar { flex-wrap: wrap; gap: 6px; }
  .src-variant-prices { padding-left: 0; }
  .src-price-row { flex-wrap: wrap; }
}

/* 플로팅 캡슐 — 체크 시 밑에서 떠오르는 재고등록 (대량등록 캡슐과 동일 톤) */
.src-capsule { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; background: #1e2330; color: #fff;
  padding: 9px 12px 9px 18px; border-radius: 999px;
  box-shadow: 0 14px 36px -10px rgba(0,0,0,.5), 0 3px 10px rgba(0,0,0,.22);
  animation: srcCapUp .28s cubic-bezier(.2,.85,.25,1); }
@keyframes srcCapUp { from { opacity: 0; transform: translate(-50%, 26px); } to { opacity: 1; transform: translate(-50%, 0); } }
.src-cap-count { font-size: 14px; font-weight: 800; white-space: nowrap; }
.src-cap-clear { width: 26px; height: 26px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.1); color: #b8bec7; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.src-cap-clear:hover { background: rgba(255,255,255,.22); color: #fff; }
.src-cap-btn { border: none; cursor: pointer; background: var(--color-primary, #ee4d2d); color: #fff;
  padding: 9px 22px; border-radius: 999px; font-size: 14px; font-weight: 800; white-space: nowrap; }
.src-cap-btn:hover { filter: brightness(1.06); }

/* 퍼블리쉬 진행 모달 */
.src-pub-modal { max-width: 520px; width: 92%; }
.pub-progress { display: flex; align-items: center; gap: 12px; padding: 28px 8px; font-size: 15px; font-weight: 600; color: #334155; }
.pub-spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid #e2e8f0; border-top-color: var(--color-primary-hover, #4338ca); border-radius: 50%; animation: srcSpin .7s linear infinite; flex: 0 0 auto; }
@keyframes srcSpin { to { transform: rotate(360deg); } }
.pub-done { padding: 4px 0; }
.pub-regmsg { white-space: pre-line; font-size: 13px; color: #475569; padding: 4px 2px 12px; line-height: 1.5; }
.pub-err-box { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 8px; white-space: pre-line; }
.pub-result-list { list-style: none; margin: 0; padding: 0; }
.pub-result-list li { padding: 9px 4px; border-bottom: 1px solid #f1f5f9; font-size: 14px; line-height: 1.4; }
.pub-result-list li:last-child { border-bottom: none; }
.pub-sku { font-family: monospace; font-weight: 800; color: #1e293b; }
.pub-ok { color: #059669; font-weight: 600; }
.pub-skip { color: #64748b; }
.pub-err { color: #dc2626; }

/* 플랫폼 테마 워터마크 기준점 (OrdersPage.css .pf-watermark 재사용) */
.src-page { position: relative; z-index: 0; }
/* ─────────────────────────────────────────────────
   SourcingMobile — 모바일 소싱/리스팅 페이지 전용 스타일
   탭/마켓토글/카드/풀스크린모달 등
   ───────────────────────────────────────────────── */

/* ─── 상단 탭 (제품목록 / 소싱 / 대량등록) ─── */
.sm-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
  padding: 0 8px;
  /* 고정(sticky) 없이 본문과 함께 스크롤 — 아래로 내리면 탭바도 같이 올라감(틈 비침 원천 차단) */
}
.sm-tab {
  flex: 1;
  padding: 12px 8px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}
.sm-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 700;
}

/* ─── 대량등록 안내 ─── */
.sm-bulk-msg {
  padding: 60px 24px;
  text-align: center;
  color: var(--color-text);
}

/* ─── 마켓플레이스 토글 (가로 스크롤) ─── */
.sm-mp-bar {
  display: flex;
  gap: 6px;
  padding: 10px 12px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.sm-mp-bar::-webkit-scrollbar { display: none; }
.sm-mp-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 16px;
  border: 1.5px solid var(--color-border);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-family: inherit;
}
.sm-mp-btn.active { font-weight: 700; background: #fff; color: var(--color-text); border-color: var(--color-primary); box-shadow: var(--pf-ring); } /* 선택=검색창 포커스 문법 */

/* ─── 선택 상태 바 (체크박스 선택 시 표시) ─── */
.sm-sel-bar {
  position: sticky;
  top: 44px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--color-primary-bg, #eff6ff);
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
}
.sm-sel-bar span { flex: 1; }
.sm-sel-cancel, .sm-sel-del {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sm-sel-cancel { background: #fff; color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.sm-sel-del { background: #dc2626; color: #fff; }

/* ─── SKU 카드 ─── */
.sm-card {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: #fff;
  margin-bottom: 8px;
  position: relative;
}
.sm-card-selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-bg, #dbeafe);
}
.sm-card-chk {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
}
.sm-card-body {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.sm-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: nowrap;
  min-width: 0;
}
.sm-card-sku {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
  font-family: 'SFMono-Regular', Menlo, monospace;
  flex-shrink: 0;
}
.sm-card-brand {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.sm-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  padding-bottom: 10px;
  margin-bottom: 10px;
  line-height: 1.4;
  word-break: break-word;
  border-bottom: 1px solid var(--color-border);
}
.sm-card-prices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.sm-price-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: var(--color-bg);
  border-left: 3px solid #cbd5e1;
}
.sm-price-flag { font-size: 14px; flex-shrink: 0; }
.sm-price-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.sm-price-val {
  font-weight: 600;
  color: var(--color-text);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sm-margin-pill {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  width: fit-content;
}
.sm-margin-pill.mr-grn { background: #d1fae5; color: #065f46; }
.sm-margin-pill.mr-blu { background: #dbeafe; color: #1e40af; }
.sm-margin-pill.mr-org { background: #fed7aa; color: #9a3412; }
.sm-margin-pill.mr-red { background: #fecaca; color: #991b1b; }
/* 괄호 병기 — 환급전(부가세환급 제외). 색 규칙(형 확정 8/5): 환급전 5%↑ 회색 / 미만 진한 빨강 (PC 동일) */
.sm-margin-x { font-size: 9px; font-weight: 700; white-space: nowrap; margin-top: 1px; display: inline-block; }
.sm-margin-x.xv-gray { color: var(--color-text-secondary); background: none; }
.sm-margin-x.xv-red { color: #b91c1c; font-weight: 800; background: none; }
/* 모달 판매가 줄 아래 환급전 표기 줄 */
.sm-modal-price-x { margin-top: 3px; text-align: right; }
.sm-margin-pill.mr-none { background: var(--color-bg); color: var(--color-text-secondary); }

/* 국가별 좌측 컬러 */
.sm-price-tag.tint-sg { border-left-color: #10b981; background: #f0fdf4; }
.sm-price-tag.tint-tw { border-left-color: #3b82f6; background: #eff6ff; }
.sm-price-tag.tint-th { border-left-color: #f59e0b; background: #fffbeb; }
.sm-price-tag.tint-my { border-left-color: #ef4444; background: #fef2f2; }
.sm-price-tag.tint-ph { border-left-color: #06b6d4; background: #ecfeff; }
.sm-price-tag.tint-id { border-left-color: #f97316; background: #fff7ed; }
.sm-price-tag.tint-jp { border-left-color: #8b5cf6; background: #f5f3ff; }
.sm-price-tag.tint-us { border-left-color: var(--color-primary, #6366f1); background: var(--color-primary-bg, #eef2ff); }

.sm-card-meta {
  font-size: 11px;
  color: var(--color-text-secondary);
}

/* ─── 임시 SKU 카드 (NEW... prefix — 사용자가 PC에서 번호 확정 전) ─── */
.sm-card-temp {
  border-color: #fbbf24;
  background: #fffbeb;
}
.sm-card-sku-temp {
  color: #92400e !important;
  background: #fef3c7;
  padding: 3px 8px;
  border-radius: 6px;
}

/* ─── 새 베이스 SKU 추가 버튼 (소싱탭 검색바 옆) ─── */
.sm-add-base-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  flex-shrink: 0;
}
.sm-add-base-btn:active { opacity: 0.85; }

/* ─── 임시 SKU 모달 안내 ─── */
.sm-modal-notice {
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: #78350f;
}
.sm-modal-notice strong {
  color: #92400e;
}

/* ─── 풀스크린 상세 모달 (portal → body 직속) ─── */
.sm-modal {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sm-modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
}
.sm-modal-close, .sm-modal-del {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text);
}
.sm-modal-close:active, .sm-modal-del:active { background: var(--color-border); }
.sm-modal-del { margin-left: auto; color: #dc2626; }
.sm-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}
/* 모달 SKU/브랜드 영역 — 테마색 그라데이션 배경, 흰 글씨.
   SKU 는 좌측 고정, 브랜드는 우측 정렬 (justify-content: space-between) 로
   넓은 공간을 양쪽으로 자연스럽게 분배. */
.sm-modal-product {
  flex-shrink: 0;
  padding: 18px 22px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #6d8aff 100%);
  border-bottom: 1px solid var(--color-border);
}
.sm-modal-product-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: nowrap;
  min-width: 0;
}
.sm-modal-sku {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  font-family: 'SFMono-Regular', Menlo, monospace;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
.sm-modal-brand {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  text-align: right;
  opacity: 0.95;
}
.sm-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
}
.sm-modal-section {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--color-border);
}
.sm-modal-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-dim);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.sm-modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  flex: 1;
  min-width: 0;
}
.sm-modal-field:last-child { margin-bottom: 0; }
.sm-modal-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.sm-modal-field input,
.sm-modal-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  font-family: inherit;
  color: var(--color-text);
  box-sizing: border-box;
}
.sm-modal-field input:focus,
.sm-modal-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}
.sm-modal-field-row {
  display: flex;
  gap: 10px;
}

/* 판매가 입력 블록 — 2줄 (헤더: 국기+국가명, 본문: 입력+통화+마진금액+마진율) */
.sm-modal-price-block {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-bg);
}
.sm-modal-price-block:last-child { border-bottom: none; }
.sm-modal-price-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}
/* 가격 입력 행 — 모든 요소 고정폭으로 통일.
   - 입력칸: 국가/값 상관없이 항상 동일 크기 (값 0/길이/포커스/패딩 변화에도 흔들리지 않음)
   - 통화/마진금액/마진율 각각 고정 폭 → 값 없을 때도 정확히 같은 자리 유지
   - 요소 사이 간격 넉넉 (12px) 으로 답답함 해소 */
.sm-modal-price-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}
.sm-modal-price-line input {
  flex: 0 0 90px;
  width: 90px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px;
  text-align: right;
  font-family: inherit;
  background: #fff;
  color: var(--color-text);
  box-sizing: border-box;
}
/* WebKit number input 의 spinner 제거 — 모바일에선 거추장스러움 */
.sm-modal-price-line input::-webkit-outer-spin-button,
.sm-modal-price-line input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.sm-modal-price-line input[type=number] { -moz-appearance: textfield; }
.sm-modal-price-line input:focus { outline: none; border-color: var(--color-primary); }
.sm-modal-price-cur {
  flex: 0 0 32px;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-align: left;
}
.sm-modal-margin-amt {
  flex: 1 1 auto;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  min-width: 60px;
  color: var(--color-text-secondary);
}
.sm-modal-margin-amt.pos { color: #059669; }
.sm-modal-margin-amt.neg { color: #dc2626; }
.sm-modal-price-line .sm-margin-pill {
  flex: 0 0 52px;
  font-size: 11px;
  padding: 3px 0;
  text-align: center;
  box-sizing: border-box;
}

/* ── base SKU prefix 그룹 (제품목록/소싱 탭) ── */
.sm-group {
  margin-bottom: 10px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-bg);
}
.sm-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 12px;
  border: none;
  background: var(--color-bg);
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.sm-group-head.open { border-bottom: 1px solid var(--color-border); }
.sm-group-chev {
  flex: 0 0 auto;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  transition: transform .15s;
}
.sm-group-chev.open { transform: rotate(90deg); }
.sm-group-pfx {
  flex: 0 0 auto;
  font-weight: 800;
  font-size: 14px;
  color: var(--color-text);
}
.sm-group-brand {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--color-border);
  color: var(--color-text-secondary);
}
.sm-group-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sm-group-cnt {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--color-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* 그룹 안의 변형 카드는 모서리 라운드 제거하고 구분선만 */
.sm-group .sm-card {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  margin: 0;
}
.ana-page { padding: 20px 24px; width: 100%; }

/* 헤더 */
.ana-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.ana-header-left { display: flex; flex-direction: column; gap: 6px; }

/* 메인 탭 — 다른 페이지(Inventory/Purchases) 스타일과 통일. */
.ana-main-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #e8e9ef;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.ana-main-tab {
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.ana-main-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* 플랫폼 필터 탭 (전체/Shopee/momo) — 제목 줄 아래 독립 줄. 로고+영문 알약 버튼 */
.ana-platform-tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.ana-platform-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; font-size: 13px; font-weight: 600;
  color: var(--color-text-secondary); background: #fff;
  border: 1px solid var(--color-border); border-radius: 999px;
  cursor: pointer; transition: all .15s;
}
.ana-platform-tab:hover { border-color: var(--color-primary-border)/*≈#c7d2fe*/; color: var(--color-primary); }
.ana-platform-tab.active {
  color: #fff; background: var(--color-primary); border-color: var(--color-primary);
}
.ana-title { font-size: 22px; font-weight: 700; color: var(--color-text); margin: 0; }
.ana-sample-badge { display: inline-block; font-size: 11px; color: var(--color-primary-hover); background: var(--color-primary-bg); border: 1px solid #f5e7c4; padding: 3px 10px; border-radius: 12px; align-self: flex-start; }

.ana-filters { display: flex; align-items: center; gap: 8px; }
.ana-select {
  padding: 7px 14px; height: 36px; border: 1px solid var(--color-border);
  border-radius: 10px; font-size: 13px; color: var(--color-text);
  background: #fff; outline: none; cursor: pointer; box-sizing: border-box;
}
.ana-select:focus { border-color: var(--color-primary); }

/* 요약 카드 8개 */
.ana-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1100px) { .ana-cards { grid-template-columns: repeat(2, 1fr); } }

.ana-card {
  background: #fff; border: 1px solid #eee; border-radius: 12px;
  padding: 18px 20px; transition: box-shadow 0.15s;
}
.ana-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.04); }
.ana-card-label {
  font-size: 12px; color: var(--color-text-secondary); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.ana-card-value {
  font-size: 22px; font-weight: 700; color: var(--color-text);
  letter-spacing: -0.5px; margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ana-card-delta { font-size: 11px; color: var(--color-text-secondary); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ana-card-prev { font-weight: 600; color: var(--color-text-secondary); }   /* 9/7 형: 지난 기간 실제 값 */
/* 카드 큰 숫자 아래 보조 표기 — 신용카드 매입액 카드의 "후불결제 +N원 별도" */
.ana-card-sub { font-size: 11px; color: var(--color-text-secondary); margin: -2px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ana-delta {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 1px 6px; border-radius: 8px; font-size: 11px; font-weight: 600;
}
.ana-delta-up   { background: #fef2f2; color: #dc2626; }
.ana-delta-down { background: #eff6ff; color: #2563eb; }
.ana-delta-zero { background: var(--color-primary-bg); color: var(--color-text-secondary); }

/* 그래프 카드 */
.ana-charts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .ana-charts { grid-template-columns: 1fr; } }
/* 한 줄 다 차지하는 큰 차트 (일자별 매출 — 28~31일 라벨 겹침 방지) */
.ana-chart-full { grid-column: 1 / -1; }

.ana-chart-card {
  background: #fff; border: 1px solid #eee; border-radius: 12px;
  padding: 18px 20px;
  /* 그래프 클릭 시 텍스트/셀 선택 효과 차단 — 호버 툴팁만 살림 */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* ─── recharts 전역 ─── PC/모바일 차트 모두에 적용.
   1) 호버/탭 시 회색 cursor 사각형 자체 차단
   2) Bar/Dot 의 active 상태 시각화 차단
   3) SVG/wrapper focus outline 차단 (모바일 탭 후 잔류 효과 방지) */
.recharts-wrapper,
.recharts-surface {
  -webkit-tap-highlight-color: transparent;
  outline: none !important;
  user-select: none;
  -webkit-user-select: none;
}
.recharts-wrapper *:focus,
.recharts-wrapper *:focus-visible,
.recharts-surface:focus,
.recharts-surface:focus-visible {
  outline: none !important;
}
.recharts-tooltip-cursor,
.recharts-rectangle.recharts-tooltip-cursor,
.recharts-active-bar {
  display: none !important;
  fill: transparent !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* 판매수량 순위 카드 — 차트 영역에 들어가는 테이블 */
.ana-rank-card {
  display: flex;
  flex-direction: column;
  /* 차트 카드와 높이 맞춤 (h:260 + 패딩+제목 ≈ 320) — 스크롤로 처리 */
  max-height: 360px;
  user-select: auto;
  -webkit-user-select: auto;
}
.ana-rank-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: -4px -4px 0;
  padding: 0 4px;
}
.ana-table-clickable tbody tr:hover td {
  background: var(--color-primary-bg);
}
.ana-rank-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  border-radius: 13px;
  background: var(--color-border);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 700;
}
/* 메달 색상 — 1등 금/2등 은/3등 동 + 그림자 */
.ana-rank-num.rank-gold {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  box-shadow: 0 2px 6px rgba(251, 191, 36, 0.4);
}
.ana-rank-num.rank-silver {
  background: linear-gradient(135deg, #d1d5db, #9ca3af);
  color: #fff;
  box-shadow: 0 2px 5px rgba(156, 163, 175, 0.4);
}
.ana-rank-num.rank-bronze {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  box-shadow: 0 2px 5px rgba(180, 83, 9, 0.4);
}
/* 1~3등 행 배경 — 위계: 1등(진) > 2등 > 3등(옅음) */
.ana-rank-row-gold td   { background: #fcd34d !important; }  /* 진한 금색 */
.ana-rank-row-silver td { background: #d1d5db !important; }  /* 중간 실버 */
.ana-rank-row-bronze td { background: #fde2c0 !important; }  /* 옅은 동색 */
.ana-rank-sku {
  font-family: 'SFMono-Regular', Menlo, monospace;
  font-size: 11px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.ana-chart-title {
  font-size: 14px; font-weight: 700; color: var(--color-text);
  margin-bottom: 12px; display: flex; align-items: center; gap: 6px;
}

/* recharts 텍스트 톤 보정 */
.recharts-default-tooltip {
  border: 1px solid #eee !important;
  background: #fff !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}
.recharts-tooltip-label { color: var(--color-text-dim) !important; font-weight: 600; }
.recharts-tooltip-item { color: var(--color-text) !important; }
.recharts-cartesian-axis-tick-value { font-family: inherit !important; }

/* 하단 2섹션 (판매수량 순위 + 국가별 분석) */
.ana-bottom { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
@media (max-width: 900px) { .ana-bottom { grid-template-columns: 1fr; } }

.ana-bottom-card {
  background: #fff; border: 1px solid #eee; border-radius: 12px;
  padding: 18px 20px;
}
.ana-bottom-title {
  font-size: 14px; font-weight: 700; color: var(--color-text);
  margin-bottom: 12px;
}

/* 하단 테이블 — 기존 페이지 테이블 패턴 */
.ana-table { width: 100%; border-collapse: collapse; }
.ana-table th {
  text-align: left; padding: 8px 10px; font-size: 11px;
  color: var(--color-text-secondary); font-weight: 600; background: #fafbfd;
  border-bottom: 1px solid #eee; white-space: nowrap;
}
.ana-table td {
  padding: 8px 10px; font-size: 12px; color: var(--color-text);
  border-bottom: 1px solid var(--color-border); vertical-align: middle;
}
.ana-table tr:hover td { background: var(--color-row-hover); }
.ana-empty { text-align: center; padding: 30px 10px !important; color: var(--color-text-secondary); font-style: italic; }

@media (max-width: 768px) {
  .ana-page { padding: 16px; }
  .ana-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ana-filters { flex-wrap: wrap; }
  .ana-title { font-size: 18px; }
  .ana-card-value { font-size: 16px; }
  .ana-card-label { font-size: 11px; }
  /* 하단 분석 테이블 — 컬럼 많으니 가로 스크롤 */
  .ana-bottom-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ana-table { min-width: 480px; font-size: 12px; }
  .ana-table th, .ana-table td { padding: 6px 8px; }
  .ana-chart-card { padding: 10px; }
}

/* 작은 폰 */
@media (max-width: 480px) {
  .ana-page { padding: 10px; }
  .ana-cards { grid-template-columns: 1fr; }
  .ana-card-value { font-size: 18px; }
  .ana-header { flex-direction: column; align-items: stretch; gap: 8px; }
}

/* 월별 주문수 플랫폼 스택 — 제목줄 범례 + 커스텀 툴팁 (기존 recharts 툴팁과 동일 톤) */
.ana-pf-legend { margin-left: auto; display: inline-flex; gap: 10px; font-size: 11px; font-weight: 500; color: var(--color-text-secondary); }
.ana-pf-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.ana-pf-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: 0 0 auto; }
.ana-stack-tip { border: 1px solid #eee; background: #fff; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.08); padding: 8px 10px; font-size: 12px; }
.ana-stack-tip-title { color: var(--color-text-dim); font-weight: 600; margin-bottom: 4px; }
.ana-stack-tip-row { display: flex; align-items: center; gap: 6px; color: var(--color-text); padding: 1px 0; }
.ana-stack-tip-row b { margin-left: auto; padding-left: 12px; }

/* 샵 필터 드롭다운 — 플랫폼 탭 줄 우측 끝 (쇼피 탭 전용, 형 2026-08-18) */
.ana-platform-row { display: flex; align-items: center; gap: 12px; }
.ana-platform-row .pftab-bar { margin-bottom: 0; flex: 1; min-width: 0; }
.ana-shop-select { flex-shrink: 0; margin-left: auto; }
/* SettingsPage.css — 머스타드 소프트 테마 */

/* ============================================================
   페이지 골격
   ============================================================ */

.set-page {
  padding: 20px 24px;
  max-width: 1600px;
}

.set-header {
  margin-bottom: 20px;
}

.set-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--color-text);
  margin-bottom: 4px;
}

.set-subtitle {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* ============================================================
   2-컬럼 레이아웃
   ============================================================ */

.set-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: flex-start;
}

.set-side {
  position: sticky;
  top: 20px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 8px;
}

.set-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.set-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.set-nav-item:hover {
  background: var(--color-bg);
}

.set-nav-item.active {
  background: var(--color-primary-bg);
}

.set-nav-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--color-border);
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.set-nav-item.active .set-nav-index {
  background: var(--color-primary);
  color: #fff;
}

.set-nav-icon {
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.set-nav-item.active .set-nav-icon {
  color: var(--color-primary);
}

.set-nav-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.set-nav-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.2;
}

.set-nav-item.active .set-nav-label {
  color: var(--color-text);
}

.set-nav-desc {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 2px;
  line-height: 1.2;
}

/* ============================================================
   메인 컬럼
   ============================================================ */

.set-main {
  min-width: 0;
}

.set-main-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.set-main-icon {
  width: 38px;
  height: 38px;
  padding: 8px;
  border-radius: 10px;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  flex-shrink: 0;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.set-main-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.set-main-desc {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.set-section-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ============================================================
   카드
   ============================================================ */

.set-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 18px 20px;
}

.set-card-info {
  background: #faf9f2;
}

.set-card-head {
  margin-bottom: 14px;
}

.set-card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.set-card-head-row > div:first-child {
  flex: 1;
  min-width: 0;
}

.set-card-head-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.set-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
}

.set-card-desc {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}

/* ============================================================
   테이블 — OrdersPage 스타일과 통일
   ============================================================ */

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

.set-table th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: 10px 12px;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.3;
  vertical-align: middle;
  letter-spacing: 0.2px;
}

.set-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  color: var(--color-text);
  line-height: 1.4;
}

/* th 정렬 helper — 그 아래 td 정렬과 일치 */
.set-th-center { text-align: center; }
.set-th-right  { text-align: right; }
.set-td-center { text-align: center; }
.set-td-right  { text-align: right; }

.set-table tbody tr:last-child td {
  border-bottom: none;
}

.set-table tbody tr:hover td {
  background: var(--color-bg);
}

.set-td-muted {
  color: var(--color-text-secondary);
}

.set-td-strong {
  font-weight: 600;
  color: var(--color-text);
}

/* 액션(맨 우측) 컬럼: 헤더와 본문이 정확히 같은 컬럼 너비를 갖도록 1%/nowrap으로
   최소 컨텐츠 너비에 고정. 자동 레이아웃이 컬럼을 늘려서 우측 정렬 텍스트가
   버튼 우측 끝과 어긋나는 현상 방지. th/td 모두 padding 10px 12px 동일. */
.set-th-actions,
.set-td-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

.set-td-actions > * {
  vertical-align: middle;
}

.set-td-actions > * + * {
  margin-left: 6px;
}

.set-empty {
  text-align: center;
  padding: 36px 12px;
  color: var(--color-text-secondary);
  font-size: 13px;
  background: var(--color-bg);
  border-radius: 8px;
}

/* ============================================================
   버튼
   ============================================================ */

.set-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 14px;
  height: 34px;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  vertical-align: middle;
  box-sizing: border-box;
}

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

.set-btn:hover {
  background: var(--color-primary-bg);
  border-color: var(--color-primary);
}

.set-btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.set-btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.set-btn-ghost {
  background: #fff;
}

.set-btn-danger {
  background: #fff;
  color: #b91c1c;
  border-color: #fecaca;
}

.set-btn-danger:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

.set-btn-sm {
  padding: 0 10px;
  height: 26px;
  font-size: 12px;
}

.set-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-left: 4px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
  padding: 0;
}

.set-icon-btn:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

/* ─── 플랫폼 로그인 정보 ─── 값(좌)/아이콘그룹(우) 양쪽 끝 분리.
   다른 CSS 가 override 못하게 !important 로 못박음. margin-left:auto + space-between 이중 안전장치. */
.set-cred-cell {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  flex: 1 1 100% !important;
  min-width: 0 !important;
  gap: 8px !important;
}
.set-cred-cell .set-cred-val {
  flex: 0 1 auto !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  text-align: left !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
.set-cred-icons {
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
  flex-shrink: 0 !important;
  margin-left: auto !important;
  margin-right: 0 !important;
}
.set-cred-icons .set-icon-btn {
  margin-left: 0 !important;
  margin-right: 0 !important;
}
/* PC: 아이디/비밀번호 컬럼 너비 동일 */
.set-table-credentials th:nth-child(2),
.set-table-credentials td:nth-child(2),
.set-table-credentials th:nth-child(3),
.set-table-credentials td:nth-child(3) {
  width: 240px;
}

/* ============================================================
   배지 / 라벨
   ============================================================ */

.set-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.4;
}

.set-badge-success { background: #d1fae5; color: #065f46; }
.set-badge-warning { background: #fef3c7; color: #7a6a28; }
.set-badge-danger  { background: #fee2e2; color: #991b1b; }
.set-badge-info    { background: #dbeafe; color: #1e40af; }
.set-badge-muted   { background: var(--color-primary-bg); color: var(--color-text-secondary); }

.set-role {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
  line-height: 1.4;
}

.set-role-owner { background: var(--color-text); color: var(--color-primary-bg); }
.set-role-admin { background: var(--color-primary-bg); color: var(--color-primary); }
.set-role-staff { background: var(--color-primary-bg); color: var(--color-text-dim); }

.set-count-pill {
  display: inline-block;
  background: var(--color-border);
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1.4;
}

/* ============================================================
   상단 stat
   ============================================================ */

.set-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.set-stat {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 16px;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.set-stat-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.set-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.set-stat-success { border-color: #bbf7d0; background: #f0fdf4; }
.set-stat-success .set-stat-value { color: #047857; }

.set-stat-warning { border-color: #fde68a; background: #fffbeb; }
.set-stat-warning .set-stat-value { color: #b45309; }

.set-stat-danger { border-color: #fecaca; background: #fef2f2; }
.set-stat-danger .set-stat-value { color: #b91c1c; }

/* ============================================================
   폼 요소
   ============================================================ */

.set-input,
.set-select {
  padding: 0 11px;
  height: 34px;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  font-size: 13px;
  color: var(--color-text);
  background: #fff;
  outline: none;
  font-family: inherit;
  min-width: 140px;
  box-sizing: border-box;
  vertical-align: middle;
  line-height: 1;
}

.set-input:disabled,
.set-select:disabled {
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: not-allowed;
}

.set-input:focus,
.set-select:focus {
  border-color: var(--color-primary);
}

.set-input-sm { padding: 0 9px; height: 26px; font-size: 12px; min-width: 130px; }

/* 시각/날짜 입력 (input[type="time"|"date"|"datetime-local"]).
   appearance: none 으로 native time picker UI(spinner/내부 패딩 등) 제거 → 다른 input 과
   동일한 외형. 클릭 시 OS native picker 가 드롭다운으로 뜨는 건 그대로 작동 (OS 가 그리는 부분). */
.set-input[type="time"],
.set-input[type="date"],
.set-input[type="datetime-local"] {
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: none;
  font-family: inherit;
  height: 34px;
  padding: 0 11px;
  min-width: 140px;
  box-sizing: border-box;
  font-size: 13px;
  text-align: left;
}
/* WebKit 내부 편집 영역 텍스트 좌측 정렬 (appearance: none 만으론 가운데로 갈 수 있음) */
.set-input[type="time"]::-webkit-datetime-edit,
.set-input[type="date"]::-webkit-datetime-edit,
.set-input[type="datetime-local"]::-webkit-datetime-edit {
  text-align: left;
  padding: 0;
}
.set-select-inline { min-width: 220px; margin-left: 4px; }
.set-select-sm { padding: 0 9px; height: 26px; font-size: 12px; min-width: 100px; }

.set-tag-mini {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  vertical-align: middle;
}
.set-tag-mini.on  { background: #d1fae5; color: #065f46; }
.set-tag-mini.off { background: #fef3c7; color: #92400e; }

.set-self-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 8px;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}

.set-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #b91c1c;
  font-size: 13px;
}

.set-info-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  color: #7a6a28;
  font-size: 12px;
  line-height: 1.5;
}

.set-info-row-stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.set-info-row-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.set-discover-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.set-chip-code {
  margin-left: 4px;
  font-size: 11.5px;
}

.set-td-sub {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}

.set-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* 모달 */
.set-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(45, 43, 36, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.set-modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.set-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
}

.set-modal-head h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}

.set-modal-body {
  padding: 18px;
  overflow-y: auto;
}

.set-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  border-radius: 0 0 12px 12px;
}

.set-field-wide {
  grid-column: 1 / -1;
}

/* 필터 알약 (OrdersPage 스타일과 통일) */
.set-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px 0;
  padding: 8px 0;
  border-bottom: 1px dashed var(--color-border);
}

.set-filter-row:last-of-type {
  border-bottom: none;
  margin-bottom: 16px;
}

.set-filter-row-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  min-width: 56px;
  margin-right: 4px;
}

.set-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 28px;
  border-radius: 16px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text-dim);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1;
  font-family: inherit;
}

.set-pill:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
}

.set-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.set-pill-count {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--color-primary-bg);
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

.set-pill.active .set-pill-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.set-pill-add {
  border-style: dashed;
  color: var(--color-primary);
}

.set-pill-add:hover {
  background: var(--color-primary-bg);
}

.set-pill-unregistered {
  border-style: dashed;
  color: #92400e;
  background: #fffbeb;
}

.set-pill-unregistered.active {
  background: #b45309;
  border-color: #b45309;
  border-style: solid;
  color: #fff;
}

.set-pill-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: var(--color-text-dim);
  cursor: pointer;
}

.set-pill-del:hover {
  background: #ef4444;
  color: #fff;
}

.set-pill.active .set-pill-del {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.set-pill.active .set-pill-del:hover {
  background: #fff;
  color: #b91c1c;
}

/* 파트너 정보 카드들 */
.set-partner-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.set-partner-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.set-partner-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
}

.set-partner-platform {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
}

.set-partner-notes {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.set-partner-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  min-height: 24px;
}

.set-partner-row-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  min-width: 96px;
}

.set-partner-date {
  font-size: 12px;
  color: var(--color-text-dim);
}

.set-partner-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.set-partner-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}

@media (max-width: 1024px) {
  .set-partner-cards {
    grid-template-columns: 1fr;
  }
}

.set-inline-input {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  vertical-align: middle;
}

.set-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 16px;
  margin-bottom: 14px;
  align-items: end;
}

.set-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.set-field-label {
  font-size: 12px;
  color: var(--color-text-dim);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}

.set-field .set-input,
.set-field .set-select {
  width: 100%;
  min-width: 0;
}

.set-mono {
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 12.5px;
  vertical-align: middle;
}

.set-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--color-primary);
  font-weight: 500;
}

.set-link:hover { text-decoration: underline; }

/* ============================================================
   체크박스 / 스위치
   ============================================================ */

.set-perm-table th:not(:first-child),
.set-perm-table td:not(:first-child) {
  text-align: center;
  width: 100px;
}

.set-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  vertical-align: middle;
}

.set-check input {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--color-border);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  position: relative;
  margin: 0;
}

.set-check input:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.set-check input:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.set-switch {
  display: inline-flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  vertical-align: middle;
}

.set-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.set-switch-track {
  display: block;
  width: 36px;
  height: 20px;
  background: var(--color-border);
  border-radius: 10px;
  position: relative;
  transition: background 0.15s;
}

.set-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: left 0.15s;
}

.set-switch input:checked + .set-switch-track {
  background: var(--color-primary);
}

.set-switch input:checked + .set-switch-track .set-switch-thumb {
  left: 18px;
}

/* ============================================================
   사업자 그룹
   ============================================================ */

.set-biz-groups {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.set-biz-group {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 14px;
}

.set-biz-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.set-biz-shops {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.set-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 14px;
  background: var(--color-primary-bg);
  color: var(--color-text-dim);
  font-size: 11.5px;
  font-weight: 500;
  vertical-align: middle;
  line-height: 1.5;
}

/* ============================================================
   환율
   ============================================================ */

.set-rates-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 12px;
}

.set-rates-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.set-rate-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}

.set-rate-flag {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 4px;
}

.set-rate-code {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.5px;
}

.set-rate-name {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.set-rate-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.3px;
}

.set-rate-change {
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 2px;
}

.set-rate-change.up { color: #dc2626; }
.set-rate-change.down { color: #2563eb; }

.set-rate-change-pct {
  font-size: 10.5px;
  font-weight: 500;
  opacity: 0.8;
}

.set-policy-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0ede0;
}

.set-policy-row:last-child { border-bottom: none; padding-bottom: 0; }
.set-policy-row:first-of-type { padding-top: 0; }

/* 정보 안내 박스 — 사방 테두리 명시. 상위 .set-policy-row :last-child rule 의 border-bottom: none 을
   덮어야 하므로 specificity 보강 (.set-policy-row.set-policy-row-tight). align-items: center 로
   아이콘과 텍스트 baseline 정렬. */
.set-policy-row.set-policy-row-tight {
  padding: 10px 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  margin-top: 12px;
  align-items: center;
}
.set-policy-row.set-policy-row-tight:last-child {
  border-bottom: 1px solid #bbf7d0;
  padding-bottom: 10px;
}
.set-policy-row.set-policy-row-tight:first-of-type {
  padding-top: 10px;
}
/* 안내 박스 안의 아이콘 작게 (32→24) — 텍스트와 시각적 균형 */
.set-policy-row-tight .set-policy-icon {
  width: 24px;
  height: 24px;
}

.set-policy-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}

.set-policy-icon-success { background: #d1fae5; color: #047857; }
.set-policy-icon-info    { background: #dbeafe; color: #1d4ed8; }

.set-policy-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}

.set-policy-desc {
  font-size: 12px;
  color: var(--color-text-dim);
  line-height: 1.5;
}

/* ============================================================
   바로가기 리스트
   ============================================================ */

.set-shortcut-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.set-shortcut-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: grab;
}

.set-shortcut-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.set-shortcut-item:hover {
  border-color: var(--color-border);
}

.set-shortcut-handle {
  color: var(--color-text-muted);
  display: flex;
}

.set-shortcut-icon {
  font-size: 18px;
}

.set-shortcut-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
}

.set-shortcut-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.set-shortcut-preview-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--color-text);
}

/* ============================================================
   템플릿 그리드
   ============================================================ */

.set-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.set-template-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.set-template-preview {
  width: 100%;
  aspect-ratio: 1;
  border: 6px solid #fbbf24;
  border-radius: 10px;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.set-template-inner {
  color: var(--color-text-muted);
}

.set-template-meta { padding: 0 2px; }

.set-template-shop {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.set-template-name {
  font-size: 12px;
  color: var(--color-primary);
  margin-top: 2px;
}

.set-template-updated {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.set-template-actions {
  display: flex;
  gap: 6px;
}

/* 샵별 테두리 — 투명 확인용 체크무늬 미리보기 */
.set-border-preview {
  border: 1px solid var(--color-border);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  /* 투명 부분이 보이도록 체크무늬 배경 */
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e2e5ea 25%, transparent 25%),
    linear-gradient(-45deg, #e2e5ea 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e5ea 75%),
    linear-gradient(-45deg, transparent 75%, #e2e5ea 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  transition: border-color .15s;
}
.set-border-preview:hover { border-color: var(--color-primary); }
.set-border-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.set-border-none {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--color-text-secondary);
  font-size: 11px;
  text-align: center;
  line-height: 1.4;
}
.set-border-upbtn { cursor: pointer; }
.set-template-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.set-template-actions .set-btn {
  flex: 1;
  justify-content: center;
}

/* ============================================================
   반응형
   ============================================================ */

@media (max-width: 1024px) {
  .set-layout { grid-template-columns: 220px 1fr; }
  .set-rates-grid { grid-template-columns: repeat(3, 1fr); }
  .set-form-grid { grid-template-columns: 1fr; }
  .set-biz-groups { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .set-page { padding: 12px; }
  .set-layout { grid-template-columns: 1fr; }
  .set-side { position: static; }
  .set-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .set-nav-item { flex-shrink: 0; }
  .set-nav-desc { display: none; }
  .set-stat-row { grid-template-columns: repeat(2, 1fr); }
  .set-rates-grid { grid-template-columns: repeat(2, 1fr); }

  /* ─── 모바일: 가로 스크롤 제거. 테이블 → 컴팩트 수평 flex 카드.
     각 row 의 셀들이 wrap 되며 한 카드 안에 가로로 흐름 (세로 길이 최소화).
     액션 셀만 마지막 줄로 분리. */
  .set-card { overflow-x: visible; }
  .set-card-head-row { flex-wrap: wrap; }

  .set-table {
    display: block;
    min-width: 0;
    font-size: 12.5px;
  }
  .set-table thead { display: none; }
  .set-table tbody { display: block; }
  .set-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 10px;
    row-gap: 2px;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
  }
  .set-table tr:hover td { background: transparent !important; }
  .set-table td {
    display: inline-flex;
    align-items: center;
    padding: 0 !important;
    border: none !important;
    font-size: 12px;
    white-space: normal;
    word-break: break-word;
    gap: 3px;
  }
  /* 첫 셀(보통 이름/SKU/실행시각) — 시각적으로 강조 */
  .set-table tbody tr td:first-child,
  .set-table .set-td-strong {
    font-weight: 700;
    color: var(--color-text);
    font-size: 13px;
  }
  /* 회색 보조 정보 */
  .set-table .set-td-muted {
    color: var(--color-text-secondary);
    font-size: 11.5px;
  }
  /* 액션 셀 — 항상 마지막 줄로 (full width) */
  .set-table .set-td-actions {
    flex-basis: 100%;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
    padding-top: 6px !important;
    border-top: 1px dashed var(--color-border) !important;
  }
  /* 인터랙티브 요소 컴팩트 */
  .set-table .set-btn-sm {
    padding: 0 8px;
    height: 26px;
    font-size: 11px;
  }
  .set-table .set-select-sm,
  .set-table .set-select {
    padding: 0 6px;
    height: 26px;
    font-size: 11px;
    min-width: 70px;
  }
  .set-table .set-input,
  .set-table .set-input-sm {
    padding: 0 8px;
    height: 26px;
    font-size: 11px;
  }
  /* set-badge 모바일에서 더 작게 */
  .set-table .set-badge {
    padding: 1px 6px;
    font-size: 10px;
  }

  /* ─── 백업 이력 — 모바일은 최근 10건만 표시 ─── */
  .set-table-history tbody tr:nth-of-type(n+11) { display: none; }

  /* ─── 권한 매트릭스 — 한 줄에 (기능 + 3 체크박스) ─── */
  .set-perm-table tr {
    flex-wrap: nowrap;
    column-gap: 8px;
    padding: 8px 10px;
  }
  .set-perm-table tr td {
    flex-shrink: 0;
  }
  .set-perm-table tr td:first-child {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
  }
  .set-perm-table tr td:nth-child(2)::before { content: "보기"; }
  .set-perm-table tr td:nth-child(3)::before { content: "수정"; }
  .set-perm-table tr td:nth-child(4)::before { content: "삭제"; }
  .set-perm-table tr td:nth-child(n+2)::before {
    font-size: 10px;
    color: var(--color-text-secondary);
    margin-right: 4px;
  }

  /* ─── 플랫폼 로그인 정보 (credentials) — 컬럼 라벨 prefix ─── */
  .set-table-credentials tr {
    flex-direction: column;
    align-items: stretch;
  }
  .set-table-credentials tr td {
    width: 100%;
    justify-content: space-between;
    padding: 5px 0 !important;
    gap: 8px;
  }
  /* 첫 셀(사이트) — 카드 헤더처럼 강조 + 하단 구분선 */
  .set-table-credentials tr td:first-child {
    font-size: 14px;
    font-weight: 700;
    border-bottom: 1px solid var(--color-border) !important;
    padding-bottom: 6px !important;
    margin-bottom: 4px !important;
  }
  /* 나머지 셀들에 라벨 prefix — min-width 65px 로 모든 라벨 동일 너비 → 우측 값들이 같은 X 에서 시작 */
  .set-table-credentials tr td:not(:first-child)::before {
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 11px;
    flex-shrink: 0;
    min-width: 65px;
  }
  .set-table-credentials tr td:nth-child(2)::before { content: "아이디"; }
  .set-table-credentials tr td:nth-child(3)::before { content: "비밀번호"; }
  /* 4,5번 셀은 JSX 에서 메모/링크 순서로 바뀜 */
  .set-table-credentials tr td:nth-child(4)::before { content: "메모"; }
  .set-table-credentials tr td:nth-child(5)::before { content: "링크"; }
  /* 메모 셀 — set-td-muted 회색 무력화, 본문 텍스트색으로 */
  .set-table-credentials td.set-td-muted { color: var(--color-text); }
  /* 관리(액션) 셀은 라벨 없음 */
  .set-table-credentials tr td.set-td-actions::before { content: ""; min-width: 0; }
  /* (구) margin-left: auto on .set-mono → 값이 우측으로 밀려서 값-컬럼 정렬 안 맞음. 제거.
     아이콘 우측 끝 정렬은 .set-cred-cell .set-icon-btn:first-of-type{margin-left:auto}로 처리됨. */

  /* ─── 샵별 테두리 (templates) — 모바일은 보기 전용 ─── */
  .set-section-templates .set-card-head-row .set-btn-primary { display: none !important; }
  .set-section-templates .set-template-actions { display: none !important; }

  /* ─── 이벤트별 채팅방 매칭 — 카드 레이아웃 통일 ─── */
  /* description 숨김 — 카드 높이 일정하게, 토글/날짜 위치 정렬 통일 */
  .set-table .set-td-sub { display: none; }
  /* 첫 셀(이벤트 라벨) 좌측 점유, 토글은 우측 끝 */
  .set-table tbody tr:has(.set-switch) .set-switch {
    margin-left: auto;
  }
  /* 인라인 input (chat_id 편집) 너비 조정 */
  .set-table .set-inline-input {
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 4px;
  }
  .set-table .set-inline-input .set-input,
  .set-table .set-inline-input .set-input-sm {
    flex: 1;
    min-width: 120px;
  }

  /* ─── credentials 모바일 편집 mode — 인풋들이 한 줄에 안 들어가서 wrap */
  .set-table-credentials tr td .set-input,
  .set-table-credentials tr td .set-input-sm {
    width: 100%;
    min-width: 0;
  }

  /* ─── 필터 row (사업자 / 플랫폼) — pill 컴팩트, 라벨 컬럼 정렬 ─── */
  .set-filter-row {
    padding: 6px 0;
    gap: 4px;
    margin-bottom: 8px;
  }
  .set-filter-row-label {
    min-width: 44px;
    font-size: 10px;
    margin-right: 2px;
  }
  .set-pill {
    height: 24px;
    padding: 0 9px;
    font-size: 11px;
    gap: 4px;
  }
  .set-pill-count {
    font-size: 10px;
    padding: 0 4px;
  }
}

/* 작은 폰 */
@media (max-width: 480px) {
  .set-page { padding: 8px; }
  .set-rates-grid { grid-template-columns: 1fr 1fr; }
  .set-stat-row { grid-template-columns: 1fr 1fr; }
  .set-card { padding: 12px; }
  /* 권한 모달 등 좁은 폰에서 가로 차지 늘림 */
  .set-perm-table { min-width: auto; }
}
/* 기기별 푸시 알림 종류 (8/26) */
.set-push-types { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.set-push-type { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-text); cursor: pointer; }
.set-push-type input { accent-color: var(--color-primary); width: 15px; height: 15px; }

/* ── 8/26 형: 폰에선 카드 머리 = 제목 → 설명 → 버튼/드롭다운(한 줄 통째). 설명이 좁은 칸에 구겨지거나 버튼이 화면 밖으로 나가던 것 전부 ── */
@media (max-width: 768px) {
  .set-card-head-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .set-card-head-row > div:first-child { flex: none; width: 100%; }
  .set-card-head-row > .set-select, .set-card-head-row > select, .set-card-head-row > .set-btn, .set-card-head-row > button { width: 100%; }
  .set-card-head-actions { width: 100%; flex-wrap: wrap; }
  .set-card-head-actions > * { flex: 1 1 auto; }
  .set-card-desc { line-height: 1.55; }
}
@media (max-width: 768px) {
  .set-perm-table tr td:first-child { white-space: nowrap; flex: 0 0 auto; min-width: 40px; margin-right: 6px; }   /* 폰: 주문/재고 라벨 세로 쪼개짐 금지 */
  .set-perm-table tr td:nth-child(n+2) { flex: 1 1 0; min-width: 0; }
}
/* ─────────────────────────────────────────────────
   SectionCredentialsMobile — 모바일 로그인 정보 전용
   PC set-table 시스템과 완전 독립. 충돌 없음.
   ───────────────────────────────────────────────── */

.credm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 헤더 */
.credm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 0;
}
.credm-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}
.credm-desc {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin: 4px 0 0 0;
  line-height: 1.4;
}
.credm-btn-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}
.credm-btn-add:disabled {
  opacity: 0.5;
}
.credm-btn-add:active {
  opacity: 0.85;
}

/* 카드 */
.credm-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}
.credm-card-edit {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-bg, #dbeafe);
}

/* 카드 헤더 — 테마색 그라데이션 */
.credm-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #6d8aff 100%);
  color: #fff;
}
.credm-card-head-edit {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}
.credm-site {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.credm-head-actions {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}
.credm-head-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.credm-head-btn:active {
  background: rgba(255, 255, 255, 0.3);
}
.credm-head-btn-danger:active {
  background: rgba(239, 68, 68, 0.8);
}
.credm-head-btn-success {
  background: rgba(255, 255, 255, 0.25);
}

/* 카드 본문 */
.credm-card-body {
  padding: 4px 14px;
}

/* ─── 핵심 row 레이아웃 ───
   label: 60px 고정 → 모든 row 의 value 가 X=68 에서 시작
   value: flex 1 → 가용 폭 다 차지
   icons: flex-shrink 0 → 우측 끝에 고정 */
.credm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-bg);
}
.credm-row:last-child {
  border-bottom: none;
}
.credm-label {
  flex: 0 0 60px;
  width: 60px;
  font-size: 11px;
  color: var(--color-text-secondary);
  font-weight: 600;
}
.credm-value {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--color-text);
  text-align: left;
}
.credm-mono {
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.credm-link {
  text-decoration: none;
  color: var(--color-primary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 아이콘 묶음 — 카드 우측 끝 */
.credm-icons {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
}
.credm-icon-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.credm-icon-btn:active {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

/* 편집 모드 폼 */
.credm-card-body-edit {
  padding: 14px;
}
.credm-edit-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}
.credm-edit-field:last-child {
  margin-bottom: 0;
}
.credm-edit-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.credm-edit-field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: var(--color-text);
  font-family: inherit;
  box-sizing: border-box;
}
.credm-edit-field input:focus {
  outline: none;
  border-color: var(--color-primary);
}
/* ─────────────────────────────────────────────────
   SectionBackupMobile — 모바일 데이터 백업 전용
   PC SettingsPage.css 와 독립 — bkpm-* prefix 만 사용. 충돌 0.
   ───────────────────────────────────────────────── */

.bkpm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ─── 카드 (3개 공통 구조) ─── */
.bkpm-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}
.bkpm-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #6d8aff 100%);
  color: #fff;
}
.bkpm-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.bkpm-card-body {
  padding: 14px;
}

/* 상태 pill */
.bkpm-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}
.bkpm-pill.off { background: rgba(0, 0, 0, 0.22); }
.bkpm-pill.muted { background: rgba(255, 255, 255, 0.18); }

/* ─── 로컬 백업 카드 ─── */
.bkpm-info-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  margin-bottom: 10px;
}
.bkpm-info-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #d1fae5;
  color: #047857;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bkpm-info-text {
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.5;
}
.bkpm-info-text strong {
  color: #047857;
}
.bkpm-info-muted {
  font-size: 11.5px;
  color: var(--color-text-secondary);
}

.bkpm-path-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--color-bg);
}
.bkpm-path-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}
.bkpm-path-value {
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--color-text);
  word-break: break-all;
}

/* ─── 버튼 ─── */
.bkpm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  height: 38px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
}
.bkpm-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.bkpm-btn:active { opacity: 0.85; }
.bkpm-btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.bkpm-btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.bkpm-btn-icon:active { background: rgba(0, 0, 0, 0.12); }

/* ─── OAuth 상태 ─── */
.bkpm-oauth-ok {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  margin-bottom: 12px;
  color: #047857;
}
.bkpm-oauth-info {
  flex: 1;
  min-width: 0;
}
.bkpm-oauth-email {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bkpm-oauth-date {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 1px;
}
.bkpm-oauth-empty {
  font-size: 12.5px;
  color: var(--color-text-secondary);
  margin: 0 0 12px 0;
}

/* ─── 폼 ─── */
.bkpm-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.bkpm-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}
.bkpm-field-row {
  display: flex;
  gap: 10px;
}
.bkpm-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.bkpm-field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: var(--color-text);
  font-family: inherit;
  box-sizing: border-box;
}
.bkpm-field input:focus {
  outline: none;
  border-color: var(--color-primary);
}
.bkpm-field input:disabled {
  background: var(--color-bg);
  color: var(--color-text-secondary);
}
/* time input — native picker 유지, 외형만 통일. WebKit 내부 텍스트 좌측 정렬 시도. */
.bkpm-field input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  text-align: left;
}
.bkpm-field input[type="time"]::-webkit-datetime-edit {
  text-align: left;
}

.bkpm-warn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 11px;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  font-size: 11.5px;
  color: #78350f;
}

/* ─── 백업 이력 ─── */
.bkpm-history {
  padding: 0;
}
.bkpm-hi-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}
.bkpm-hi-item:last-child {
  border-bottom: none;
}
.bkpm-hi-line1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.bkpm-hi-time {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-text);
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}
.bkpm-hi-status {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}
.bkpm-hi-status.ok { background: #d1fae5; color: #065f46; }
.bkpm-hi-status.info { background: #dbeafe; color: #1e40af; }
.bkpm-hi-status.danger { background: #fecaca; color: #991b1b; }

.bkpm-hi-line2 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--color-text-secondary);
}
.bkpm-hi-type {
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 10px;
}
.bkpm-hi-type.manual { background: #dbeafe; color: #1e40af; }
.bkpm-hi-type.auto { background: var(--color-bg); color: var(--color-text-secondary); }
.bkpm-hi-who {
  margin-left: auto;
  font-weight: 600;
}

.bkpm-hi-actions {
  display: flex;
  gap: 14px;
  margin-top: 6px;
}
.bkpm-hi-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}
.bkpm-hi-link:active { opacity: 0.7; }

.bkpm-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-style: italic;
}
.bkpm-error {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--color-danger, #dc2626);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
/* 모바일 채팅 — 목록 ↔ 대화 토글 */

.chat-mobile-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
}

.chat-mobile-page.list-view .chat-search-wrap {
  border-bottom: 1px solid #e5e2d3;
  background: #faf8f1;
}

.chat-conv-list.mobile {
  flex: 1;
  overflow-y: auto;
}

.chat-header.mobile {
  position: relative;
}

.chat-back-btn {
  background: transparent;
  border: none;
  padding: 6px;
  margin-right: 2px;
  color: #3d3a2d;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 모바일에선 메시지 폭 살짝 더 넓게 */
.chat-mobile-page .chat-msg { max-width: 80%; }

/* 입력창 하단 safe area */
.chat-mobile-page .chat-input-wrap {
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.syslog-page { display: flex; flex-direction: column; gap: 16px; padding: 16px; max-width: 1600px; margin: 0 auto; }
.syslog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.syslog-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 22px; font-weight: 700; color: var(--color-text); }
.syslog-subtitle { margin: 4px 0 0; font-size: 12px; color: var(--color-text-dim); }

.syslog-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.syslog-sum-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 12px 14px; }
.syslog-sum-label { font-size: 11px; font-weight: 700; color: var(--color-text-dim); text-transform: uppercase; margin-bottom: 8px; }
.syslog-sum-row { display: flex; gap: 6px; flex-wrap: wrap; }
.syslog-chip { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.syslog-chip.ok { background: #ecfdf5; color: #047857; }
.syslog-chip.fail { background: #fef2f2; color: #b91c1c; }
.syslog-chip.warn { background: #fef3c7; color: #92400e; }
.syslog-chip.skip { background: #f1f5f9; color: #64748b; }
.syslog-chip.crit { background: #fecaca; color: #7f1d1d; font-weight: 800; }

.syslog-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); }
.syslog-tab { display: flex; align-items: center; gap: 6px; padding: 9px 16px; background: transparent; border: none; border-bottom: 2px solid transparent; font-size: 13px; font-weight: 600; color: var(--color-text-secondary); cursor: pointer; margin-bottom: -1px; }
.syslog-tab:hover { color: var(--color-text); }
.syslog-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.syslog-filters { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.syslog-select { padding: 6px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); font-size: 12px; color: var(--color-text); }
.syslog-search { padding: 6px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); font-size: 12px; color: var(--color-text); font-family: 'SFMono-Regular', Menlo, monospace; min-width: 200px; }
.syslog-search:focus { border-color: var(--color-primary); outline: none; }
.syslog-date { padding: 6px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); font-size: 12px; color: var(--color-text); font-family: 'SFMono-Regular', Menlo, monospace; }
.syslog-date-sep { color: var(--color-text-dim); font-weight: 600; }
.syslog-btn-quick { padding: 6px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); font-size: 11px; font-weight: 700; color: var(--color-text-secondary); cursor: pointer; }
.syslog-btn-quick:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.syslog-filters-sep { width: 1px; height: 22px; background: var(--color-border); margin: 0 4px; }
.syslog-total { margin-left: auto; font-size: 12px; color: var(--color-text-dim); font-weight: 600; }

.syslog-table-wrap { border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: auto; max-height: calc(100vh - 380px); }
.syslog-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.syslog-table thead { position: sticky; top: 0; background: var(--color-bg); z-index: 2; }
.syslog-table th { padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 700; color: var(--color-text-dim); text-transform: uppercase; border-bottom: 1px solid var(--color-border); }
.syslog-table td { padding: 9px 12px; border-bottom: 1px solid var(--color-border); color: var(--color-text); }
.syslog-row { cursor: pointer; transition: background 0.1s; }
.syslog-row:hover { background: var(--color-bg); }
.syslog-td-time { font-family: 'SFMono-Regular', Menlo, monospace; font-size: 11px; color: var(--color-text-dim); white-space: nowrap; }
.syslog-td-mono { font-family: 'SFMono-Regular', Menlo, monospace; font-size: 11px; }
.syslog-td-err { color: #b91c1c; font-size: 11px; max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.syslog-status-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; color: #fff; text-transform: uppercase; }
.syslog-status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.syslog-sev-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; color: #fff; text-transform: uppercase; }
.syslog-retry-badge { display: inline-block; padding: 1px 6px; border-radius: 4px; background: #f59e0b; color: #fff; font-size: 10px; font-weight: 700; margin-left: 4px; }
.syslog-resolved-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: #ecfdf5; color: #047857; font-size: 11px; font-weight: 700; }
.syslog-resolved { color: #047857; font-size: 11px; font-weight: 700; margin-top: 4px; }

.syslog-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); }
.syslog-btn:hover:not(:disabled) { background: var(--color-bg); }
.syslog-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.syslog-btn.primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.syslog-btn.primary:hover { background: var(--color-primary-hover); }
.syslog-btn-sm { display: inline-flex; align-items: center; gap: 3px; padding: 4px 6px; border-radius: 4px; background: var(--color-surface); border: 1px solid var(--color-border); cursor: pointer; color: var(--color-text-secondary); }
.syslog-btn-sm:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.syslog-pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; font-size: 12px; color: var(--color-text-dim); }

.syslog-loading, .syslog-empty { padding: 40px; text-align: center; color: var(--color-text-muted); font-size: 13px; }

/* 모달 */
.syslog-modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.syslog-modal { width: 100%; max-width: 720px; max-height: 88vh; background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); display: flex; flex-direction: column; }
.syslog-modal-head { padding: 14px 18px; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; justify-content: space-between; }
.syslog-modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.syslog-modal-head button { background: transparent; border: none; cursor: pointer; color: var(--color-text-secondary); width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.syslog-modal-head button:hover { background: var(--color-bg); color: var(--color-text); }
.syslog-modal-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }

.syslog-detail-row { display: flex; align-items: center; gap: 12px; padding: 6px 10px; background: var(--color-bg); border-radius: var(--radius-sm); }
.syslog-detail-label { flex-shrink: 0; width: 100px; font-size: 11px; font-weight: 700; color: var(--color-text-dim); text-transform: uppercase; }
.syslog-detail-val { flex: 1; font-size: 13px; color: var(--color-text); word-break: break-all; }
.syslog-detail-val.mono { font-family: 'SFMono-Regular', Menlo, monospace; font-size: 12px; }

.syslog-modal-section { display: flex; flex-direction: column; gap: 4px; }
.syslog-modal-section-label { font-size: 11px; font-weight: 700; color: var(--color-text-dim); text-transform: uppercase; padding: 0 4px; }
.syslog-pre { margin: 0; padding: 10px 12px; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-family: 'SFMono-Regular', Menlo, monospace; font-size: 11px; color: var(--color-text); overflow: auto; max-height: 300px; white-space: pre-wrap; word-break: break-all; }
.syslog-modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 8px; border-top: 1px solid var(--color-border); margin-top: 8px; }

/* 모바일 카드 */
.syslog-cards { display: flex; flex-direction: column; gap: 8px; }
.syslog-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 10px 12px; cursor: pointer; }
.syslog-card:active { background: var(--color-bg); }
.syslog-card-head { display: flex; align-items: center; gap: 8px; }
.syslog-card-title { flex: 1; font-size: 13px; font-weight: 600; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.syslog-card-time { font-size: 11px; color: var(--color-text-dim); font-family: 'SFMono-Regular', Menlo, monospace; flex-shrink: 0; }
.syslog-card-meta { display: flex; gap: 8px; margin-top: 4px; font-size: 11px; color: var(--color-text-dim); }
.syslog-card-err { margin-top: 6px; padding: 6px 8px; background: #fef2f2; color: #b91c1c; font-size: 11px; border-radius: 4px; word-break: break-word; }

@media (max-width: 768px) {
  .syslog-page { padding: 12px; }
  .syslog-summary { grid-template-columns: 1fr; }
}
.disc-page { padding: 20px 24px 60px; width: 100%; }

/* 헤더 */
.disc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.disc-title { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 700; color: #1e293b; margin: 0; }
.disc-subtitle { color: #64748b; font-size: 13px; margin: 6px 0 0; line-height: 1.5; }
.disc-subtitle b { color: var(--color-primary-hover, #4338ca); }
.disc-header-btns { display: flex; gap: 8px; flex-shrink: 0; }

.disc-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 9px;
  border: 1px solid #e2e8f0; background: #fff; color: #334155; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.disc-btn:hover:not(:disabled) { background: #f8fafc; border-color: #cbd5e1; }
.disc-btn.primary { background: var(--color-primary, #4f46e5); border-color: var(--color-primary, #4f46e5); color: #fff; }
.disc-btn.primary:hover:not(:disabled) { background: var(--color-primary-hover, #3730a3); }
.disc-btn:disabled { opacity: .55; cursor: not-allowed; }

.disc-spin { animation: disc-spin 1s linear infinite; }
@keyframes disc-spin { to { transform: rotate(360deg); } }

.disc-running {
  display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 10px 14px;
  background: var(--color-primary-bg, #eef2ff); border: 1px solid var(--color-primary-border, #c7d2fe); border-radius: 9px; color: var(--color-primary-hover, #4338ca); font-size: 13px; font-weight: 500;
}

/* 요약 카드 */
.disc-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.disc-sum-card {
  display: flex; align-items: center; gap: 12px; padding: 16px; background: #fff;
  border: 1px solid #eef0f4; border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.disc-sum-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.disc-sum-icon.ok { background: #dcfce7; color: #16a34a; }
.disc-sum-icon.warn { background: #fef3c7; color: #d97706; }
.disc-sum-icon.info { background: var(--color-primary-bg, #e0e7ff); color: var(--color-primary-hover, #4338ca); }
.disc-sum-num { font-size: 22px; font-weight: 700; color: #1e293b; line-height: 1.1; }
.disc-sum-label { font-size: 12px; color: #64748b; margin-top: 2px; }

/* 섹션 타이틀 */
.disc-section-title { font-size: 15px; font-weight: 700; color: #334155; margin: 28px 0 12px; }

/* 샵 그리드 */
.disc-shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.disc-shop-card { padding: 14px; background: #fff; border: 1px solid #eef0f4; border-radius: 12px; }
.disc-shop-head { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; }
.disc-shop-flag { font-size: 16px; }
.disc-shop-name { font-size: 13px; font-weight: 600; color: #1e293b; }
.disc-shop-empty { font-size: 12px; color: #94a3b8; padding: 6px 0; }
.disc-shop-bar { height: 6px; background: #f1f5f9; border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.disc-shop-bar-fill { height: 100%; background: linear-gradient(90deg, #34d399, #10b981); border-radius: 99px; transition: width .4s; }
.disc-shop-stats { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.disc-stat { font-size: 12px; font-weight: 600; }
.disc-stat.ok { color: #16a34a; }
.disc-stat.warn { color: #d97706; }
.disc-stat.muted { color: #94a3b8; margin-left: auto; }
.disc-shop-time { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #94a3b8; margin-top: 9px; }

/* 미매칭 */
.disc-unmatched { margin-top: 24px; background: #fff; border: 1px solid #eef0f4; border-radius: 12px; overflow: hidden; }
.disc-unmatched-head {
  width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px;
  background: none; border: none; cursor: pointer; font-size: 14px; font-weight: 600; color: #334155;
}
.disc-unmatched-head span { display: inline-flex; align-items: center; gap: 7px; }
.disc-unmatched-head:hover { background: #f8fafc; }
.disc-unmatched-body { padding: 0 16px 16px; }
.disc-hint { font-size: 12.5px; color: #64748b; line-height: 1.6; background: #f8fafc; padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; }
.disc-unmatched-table-wrap { max-height: 420px; overflow: auto; border: 1px solid #f1f5f9; border-radius: 8px; }

.disc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.disc-table th { position: sticky; top: 0; background: #f8fafc; text-align: left; padding: 8px 10px; color: #64748b; font-weight: 600; border-bottom: 1px solid #eef0f4; }
.disc-table td { padding: 8px 10px; border-bottom: 1px solid #f5f6f8; color: #334155; }
.disc-table tr:last-child td { border-bottom: none; }
.disc-mono { font-family: ui-monospace, Menlo, monospace; }
.disc-muted { color: #94a3b8; }
.disc-name { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 할인 적용 (예정) */
.disc-apply-soon {
  display: flex; gap: 16px; align-items: flex-start; padding: 20px; background: #fafafe;
  border: 1px dashed var(--color-primary-border, #c7d2fe); border-radius: 12px;
}
.disc-apply-icon { width: 56px; height: 56px; border-radius: 14px; background: var(--color-primary-bg, #eef2ff); color: var(--color-primary, #6366f1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.disc-apply-title { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--color-primary-hover, #4338ca); }
.disc-apply-desc { font-size: 13px; color: #64748b; line-height: 1.65; margin: 6px 0 0; }
.disc-apply-desc b { color: #334155; }

.disc-empty { color: #94a3b8; font-size: 13px; padding: 30px; text-align: center; }
.disc-empty.small { padding: 16px; }

/* ── 일괄 적용 모달 ── */
.disc-modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 3000; padding: 20px; overscroll-behavior: contain; touch-action: none; }
.disc-modal { background: #fff; border-radius: 14px; width: 100%; max-width: min(1320px, 95vw); max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
/* 본문 2단 = 두 개의 명확한 패널(테두리+제목바) */
.disc-modal-cols { display: flex; gap: 16px; align-items: flex-start; }
.disc-panel { min-width: 0; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.disc-panel-left { flex: 1; }
.disc-panel-right { flex: 1.7; }
.disc-panel-title { display: flex; align-items: center; gap: 6px; background: #f1f5f9; padding: 11px 14px; font-size: 13px; font-weight: 700; color: #334155; border-bottom: 1px solid #e2e8f0; }
/* 샵별표 숫자: 볼드 통일 + 0은 기본색, 값>0만 현황 색상 */
.disc-table td.disc-num { font-weight: 600; }
.disc-cnt-blue { color: #2563eb; }
/* 표 기본 td 색(.disc-table td)이 우선이라 덮였음 → td 한정으로 색 우선순위 올림 */
.disc-table td.disc-cnt-ok { color: #16a34a; }
.disc-table td.disc-cnt-blue { color: #2563eb; }
.disc-table td.disc-cnt-warn { color: #d97706; }
.disc-table td.disc-cnt-muted { color: #94a3b8; }
/* 경고/보류 문구 아이콘 정렬 */
.disc-modal-note, .disc-modal-warn { display: flex; align-items: center; gap: 6px; }
.disc-panel-body { padding: 10px 12px; }
.disc-panel-scroll { padding: 0; max-height: 440px; overflow-y: auto; overflow-x: hidden; }
/* 스크롤 시 제목바 밑으로 행이 비쳐 보이지 않게 — 헤더 불투명 + 위에 딱 붙임 */
.disc-panel-scroll .disc-table thead th { position: sticky; top: 0; background: #eef1f6; z-index: 1; }
/* 적용상품 표: 상품명만 …(말줄임), 가격은 절대 안 잘림 */
.disc-prodtable td, .disc-prodtable th { white-space: nowrap; }
.disc-prodtable .disc-name { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px) { .disc-modal-cols { flex-direction: column; } .disc-panel-right { flex: 1; } }
.disc-modal-head { padding: 18px 24px; }
.disc-modal-head h3 { font-size: 18px; }
.disc-modal-body { padding: 20px 24px; }
.disc-modal .disc-table th, .disc-modal .disc-table td { padding: 9px 12px; font-size: 13px; }
.disc-prodlist { margin-top: 16px; }
.disc-prodlist-title { font-size: 14px; font-weight: 700; color: #334155; margin-bottom: 8px; }
.disc-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #eef0f4; }
.disc-modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: #1e293b; }
.disc-modal-x { background: none; border: none; cursor: pointer; color: #94a3b8; display: flex; }
.disc-modal-x:hover { color: #334155; }
.disc-modal-body { padding: 18px 20px; overflow: auto; overscroll-behavior: contain; touch-action: pan-y; }
.disc-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid #eef0f4; }

.disc-modal-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px; }
.disc-msum { text-align: center; padding: 16px 8px; background: #f8fafc; border: 1px solid #eef0f4; border-radius: 10px; font-size: 13px; color: #64748b; }
.disc-msum-n { font-size: 28px; font-weight: 800; color: #1e293b; line-height: 1.1; margin-bottom: 4px; }

.disc-modal-note { margin-top: 12px; padding: 10px 12px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 9px; font-size: 12.5px; color: #92400e; }
.disc-modal-note b { color: #78350f; }
.disc-modal-warn { margin-top: 12px; font-size: 13px; font-weight: 600; color: #b45309; }

.disc-modal-done { text-align: center; padding: 10px 0; }
.disc-done-big { font-size: 20px; font-weight: 700; color: #16a34a; margin-bottom: 14px; }
.disc-done-row { display: flex; justify-content: space-between; max-width: 260px; margin: 6px auto; font-size: 14px; color: #475569; }

@media (max-width: 768px) {
  .disc-modal-summary { grid-template-columns: repeat(2, 1fr); }
}

/* ── 플랫폼 선택 (탭 위 독립된 윗줄 = 상위 레벨) ── */
.disc-platform-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.disc-platform-label { font-size: 11px; font-weight: 700; color: var(--color-text-secondary, #94a3b8); letter-spacing: 0.02em; }
.disc-platform { display: flex; align-items: center; gap: 6px; }
.disc-plat-btn { padding: 5px 12px; border-radius: 7px; border: 1px solid var(--color-border, #e2e8f0); background: var(--color-surface, #fff); font-size: 12px; font-weight: 600; color: var(--color-text-secondary, #64748b); cursor: pointer; }
.disc-plat-btn.active { background: var(--color-primary, var(--color-primary-hover, #4338ca)); border-color: var(--color-primary, var(--color-primary-hover, #4338ca)); color: #fff; }
.disc-plat-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── 탭 (메인 페이지 상단탭 .inv-main-tab 과 동일: 15px · padding 10px 24px · 풀폭 밑줄, 맨 위) ── */
/* 가로 스크롤 힌트 래퍼 — 스크롤 가능 방향에 화살표+페이드 */
.disc-tabs-wrap { position: relative; }
.disc-tab-arrow { position: absolute; top: 0; bottom: 2px; width: 44px; display: flex; align-items: center;
  pointer-events: none; font-size: 24px; font-weight: 700; color: var(--color-primary); z-index: 2; }
.disc-tab-arrow.right { right: 0; justify-content: flex-end; padding-right: 6px;
  background: linear-gradient(to right, transparent, var(--color-bg, #fcfcfd) 55%); }
.disc-tab-arrow.left { left: 0; justify-content: flex-start; padding-left: 6px;
  background: linear-gradient(to left, transparent, var(--color-bg, #fcfcfd) 55%); }

/* 소싱 페이지(.src-main-tabs) 스타일 기준 + 가로 스와이프(세로 잠금) */
.disc-tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 10px;
  overflow-x: auto; overflow-y: hidden; touch-action: pan-x; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.disc-tabs::-webkit-scrollbar { display: none; }
.disc-tab { display: flex; align-items: center; gap: 5px; padding: 10px 24px; background: none; border: none; border-bottom: 2px solid transparent; font-size: 15px; font-weight: 600; /* 주문관리 메인탭 규격 */ color: var(--color-text-secondary, #64748b); cursor: pointer; margin-bottom: -1px; transition: color 0.15s; white-space: nowrap; flex: 0 0 auto; font-family: inherit; }
.disc-tab:hover { color: var(--color-text, #1e293b); }
.disc-tab.active { color: var(--color-primary, var(--color-primary-hover, #4338ca)); border-bottom-color: var(--color-primary, var(--color-primary-hover, #4338ca)); font-weight: 700; }
.disc-soon-chip { font-size: 10px; font-weight: 700; color: #b6bdc9; border: 1px solid #e2e8f0; border-radius: 5px; padding: 0 4px; }
.disc-tabbody { margin-top: 16px; }

/* ── 전 샵 일괄 적용 바 ── */
.disc-apply-bar { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--color-primary-bg, #eef2ff); border: 1px solid var(--color-primary-border, #c7d2fe); border-radius: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.disc-btn.lg { padding: 10px 18px; font-size: 14px; }
.disc-apply-hint { font-size: 12px; color: #4f5b76; line-height: 1.5; flex: 1; min-width: 200px; }

/* ── 캠페인 필터 ── */
.disc-camp-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.disc-fld { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #64748b; font-weight: 600; }
.disc-fld select { padding: 7px 10px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; font-size: 13px; color: #334155; }
.disc-seg { display: inline-flex; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.disc-seg-btn { padding: 7px 14px; background: #fff; border: none; border-right: 1px solid #e2e8f0; font-size: 12px; font-weight: 600; color: #64748b; cursor: pointer; }
.disc-seg-btn:last-child { border-right: none; }
.disc-seg-btn.active { background: #fff; color: var(--color-text, #1e293b); font-weight: 700; box-shadow: inset 0 0 0 2px var(--color-primary); } /* 선택=테두리 강조 (형 7/17) */
.disc-camp-count { margin-left: auto; font-size: 12px; color: #94a3b8; font-weight: 600; }

/* ── 캠페인 목록 ── */
.disc-camp-list { display: flex; flex-direction: column; gap: 8px; }
.disc-camp-card { background: #fff; border: 1px solid var(--pf-card-border); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(15,23,42,0.06); } /* 교차색 제거+얇고 진한 테두리 (형 7/17) */
.disc-camp-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 14px; background: none; border: none; cursor: pointer; text-align: left; }
/* 호버 — 교차색 줄에도 먹도록 같은 우선순위로 명시 */
.disc-camp-row:hover { background: var(--pf-hover); }
.disc-camp-card:has(.disc-camp-caret.open) { border-color: var(--color-primary-border, #c7d2fe); box-shadow: 0 0 0 1px var(--color-primary-border, #c7d2fe) inset; }
.disc-camp-caret { color: #94a3b8; transition: transform .15s; flex-shrink: 0; }
.disc-camp-caret.open { transform: rotate(90deg); }
/* 열 너비 고정 → 캠페인명이 세로로 일자 정렬 */
.disc-camp-shop { width: 168px; flex-shrink: 0; font-size: 14px; font-weight: 700; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.disc-camp-status { box-sizing: border-box; width: 54px; flex-shrink: 0; text-align: center; font-size: 11px; font-weight: 700; padding: 2px 0; border-radius: 999px; }
.disc-camp-status.ongoing { background: #dcfce7; color: #16a34a; }
.disc-camp-status.upcoming { background: #dbeafe; color: #2563eb; }
.disc-camp-status.expired { background: #f1f5f9; color: #94a3b8; }
.disc-camp-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.disc-camp-counts { width: 280px; flex-shrink: 0; font-size: 12px; text-align: right; white-space: nowrap; }
.disc-cnt-ok { color: #16a34a; font-weight: 600; }
.disc-cnt-warn { color: #d97706; font-weight: 600; }
.disc-cnt-muted { color: #94a3b8; font-weight: 500; }
.disc-cnt-hold { color: #7c3aed; font-weight: 600; }
.disc-camp-period { width: 150px; flex-shrink: 0; text-align: right; font-size: 12px; color: #64748b; font-family: ui-monospace, Menlo, monospace; white-space: nowrap; }
.disc-camp-detail { border-top: 1px solid #f1f5f9; padding: 12px 14px; }
.disc-detail-head { font-size: 12.5px; font-weight: 600; color: #475569; }
.disc-detail-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.disc-detail-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.disc-detail-search { padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 12.5px; min-width: 240px; }
.disc-detail-search:focus { outline: none; border-color: var(--color-primary-hover, #4338ca); }

/* 열 구분선 (세로줄) — 칸 구분 또렷하게 */
.disc-table th, .disc-table td { border-right: 1px solid #eef0f4; }
.disc-table th:last-child, .disc-table td:last-child { border-right: none; }
/* 구매자가 = 보조색(빨강 할인가와 구분) */
.disc-table td.disc-buyer { color: #64748b; }
.disc-promo { color: #b91c1c; font-weight: 700; }
/* 표 안에서는 td 기본색(.disc-table td)이 우선순위로 덮어써서 빨강이 안 먹음 → td 한정으로 강제 */
.disc-table td.disc-promo { color: #b91c1c; font-weight: 700; }

/* ── 매칭 탭 헤더 ── */
.disc-matching-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }

/* ── 모바일 다듬기: 캠페인 카드 3줄 그리드 + 모달 가독성 ── */
@media (max-width: 768px) {
  .disc-camp-count { margin-left: 0; }

  /* 상단 탭 — 3개라 데스크탑 크기론 2줄 됨 → 작게 + flex로 한 줄에 균등 분배 */
  /* 탭은 소싱 페이지와 동일하게 모바일/데스크탑 공통 — 별도 축소 없이 가로 스와이프로 처리 */
  .disc-tab svg { width: 14px; height: 14px; }
  .disc-soon-chip { display: none; }

  /* 캠페인 카드 — 고정폭 5칸 대신 3줄 그리드 (짤림/제멋대로 줄바꿈 해결) */
  .disc-camp-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "caret shop status"
      "caret name name"
      "counts counts period";
    gap: 4px 8px;
    padding: 12px 14px;
    align-items: center;
  }
  .disc-camp-caret { grid-area: caret; align-self: start; margin-top: 2px; }
  .disc-camp-shop { grid-area: shop; width: auto; min-width: 0; font-size: 14px; }
  .disc-camp-status { grid-area: status; justify-self: end; width: 48px; }
  .disc-camp-name { grid-area: name; width: auto; white-space: normal; font-size: 13px; line-height: 1.35; }
  .disc-camp-counts { grid-area: counts; width: auto; text-align: left; white-space: normal; line-height: 1.45; margin-top: 2px; }
  .disc-camp-period { grid-area: period; width: auto; text-align: right; align-self: end; font-size: 11px; }

  /* 모달 — 요약 2칸 + 표 가로 스크롤 */
  .disc-modal-head { padding: 13px 16px; }
  .disc-modal-head h3 { font-size: 15px; }
  .disc-modal-body { padding: 14px; }
  .disc-modal-summary { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .disc-msum { padding: 10px 6px; font-size: 11.5px; }
  .disc-msum-n { font-size: 22px; }
  .disc-modal-cols { gap: 12px; }
  /* 표는 칸 찌그러뜨리지 말고 옆으로 스크롤(잘림/줄바꿈 방지) */
  .disc-panel-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .disc-panel-scroll { overflow-x: auto; }
  .disc-modal .disc-table { width: auto; min-width: 100%; }
  .disc-modal .disc-table th, .disc-modal .disc-table td { white-space: nowrap; padding: 7px 10px; font-size: 12px; }
  .disc-prodtable .disc-name { max-width: 160px; }
  /* 좌측 샵별표도 칸 안 무너지게 nowrap */
  .disc-panel-left .disc-table th, .disc-panel-left .disc-table td { white-space: nowrap; }
}

/* 모바일 */
@media (max-width: 768px) {
  .disc-page { padding: 14px 14px 80px; }
  .disc-header-btns { width: 100%; }
  .disc-header-btns .disc-btn { flex: 1; justify-content: center; }
  .disc-summary { grid-template-columns: 1fr; }
  .disc-shop-grid { grid-template-columns: 1fr 1fr; }
  .disc-name { max-width: 140px; }
}

/* ── 바우처: 국가 세그 국기 ── */
.disc-seg-flag { display: inline-flex; align-items: center; gap: 5px; }

/* ── 바우처: 샵별 그룹 ── */
.disc-vou-groups { display: flex; flex-direction: column; gap: 14px; }
.disc-vou-group { background: #fff; border: 1.5px solid var(--color-primary-border, #c7d2fe); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(99,102,241,0.10); }
.disc-vou-ghead { width: 100%; display: flex; align-items: center; gap: 9px; padding: 13px 16px; background: var(--color-primary, #4f46e5); border: none; cursor: pointer; text-align: left; }
.disc-vou-ghead:hover { background: var(--color-primary-hover, #4338ca); }
.disc-vou-gname { font-size: 14.5px; font-weight: 800; color: #fff; }
.disc-vou-gcount { margin-left: auto; font-size: 12px; color: var(--color-primary-border, #c7d2fe); font-weight: 600; }
.disc-vou-ghead .disc-camp-caret { color: var(--color-primary-border, #c7d2fe); }
.disc-vou-groups { display: flex; flex-direction: column; gap: 14px; }   /* 샵 그룹 간 간격 ↑ */

/* ── 바우처 행 (그룹 안, 샵은 헤더에 있으니 생략) — 종류배지·이름코드 열 정렬 ── */
.disc-vou-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #f5f6f8; }
.disc-vou-group .disc-vou-row:last-child { border-bottom: none; }
/* 종류 배지 = 고정폭 열 (세로 정렬) — 더 크게 */
.disc-vou-kind { flex: 0 0 138px; box-sizing: border-box; margin-right: 8px; text-align: center; font-size: 12.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--color-primary-bg, #eef2ff); border: 1px solid var(--color-primary-border, #c7d2fe); color: var(--color-primary-hover, #4338ca); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 이름-코드 묶음 = 강조 아닌 연한 회색, 글자 길이에 딱 맞게(안 늘어남) */
.disc-vou-tag { flex: 0 1 auto; min-width: 0; max-width: 360px; font-size: 12px; font-weight: 600; color: #475569; background: #f1f5f9; border: 1px solid #e2e8f0; padding: 3px 9px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 할인율 — 고정폭 칸으로 세로 정렬 (메인=어두운 빨강 배지 / 최대=청록 배지, 한 줄) */
.disc-vou-reward { flex: 0 0 168px; margin-left: auto; display: flex; flex-direction: row; align-items: center; gap: 6px; }
.disc-vou-rwd-main { flex: 0 0 64px; box-sizing: border-box; text-align: center; font-size: 13.5px; font-weight: 800; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; padding: 4px 9px; border-radius: 8px; white-space: nowrap; }
.disc-vou-rwd-cap { flex: 0 1 auto; min-width: 0; font-size: 12.5px; font-weight: 700; color: #0d9488; background: #f0fdfa; border: 1px solid #99f6e4; padding: 4px 9px; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.disc-vou-meta { width: 170px; flex-shrink: 0; text-align: right; font-size: 12px; color: #64748b; white-space: nowrap; }

@media (max-width: 768px) {
  .disc-vou-row { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "kind reward" "tag tag" "meta period"; gap: 5px 8px; padding: 11px 12px; align-items: center; }
  .disc-vou-kind { grid-area: kind; flex: none; width: auto; justify-self: start; }
  .disc-vou-tag { grid-area: tag; white-space: normal; }
  .disc-vou-reward { grid-area: reward; width: auto; text-align: right; }
  .disc-vou-meta { grid-area: meta; width: auto; text-align: left; white-space: normal; }
  .disc-camp-period { grid-area: period; }
}

/* ── 바우처 행 액션 (자동갱신 토글 + 복사/수정/종료) ── */
.disc-vou-acts { flex: 0 0 236px; display: inline-flex; gap: 6px; justify-content: flex-end; align-items: center; }
.disc-vou-act { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border: 1px solid #e2e8f0; background: #fff; border-radius: 7px; font-size: 11.5px; font-weight: 600; color: var(--color-primary-hover, #4338ca); cursor: pointer; white-space: nowrap; }
.disc-vou-act:hover { background: var(--color-primary-bg, #eef2ff); border-color: var(--color-primary-border, #c7d2fe); }
.disc-vou-act.danger { color: #b91c1c; }
.disc-vou-act.danger:hover { background: #fef2f2; border-color: #fecaca; }
/* 자동갱신 토글 */
.disc-vou-renew { display: inline-flex; align-items: center; gap: 3px; padding: 4px 8px; border: 1px solid #e2e8f0; background: #fff; border-radius: 7px; font-size: 11px; font-weight: 800; color: #94a3b8; cursor: pointer; white-space: nowrap; }
.disc-vou-renew.on { background: #dcfce7; border-color: #86efac; color: #15803d; }

/* ── 바우처 생성/복사 모달 폼 ── */
.disc-vou-modal { max-width: 520px; }
.disc-vform { display: flex; flex-direction: column; gap: 10px; }
.disc-vf-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #334155; }
.disc-vf-row > span:first-child { flex: 0 0 96px; font-weight: 600; color: #475569; }
.disc-vf-row input, .disc-vf-row select { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; background: #fff; }
.disc-vf-dates { flex: 1; display: flex; align-items: center; gap: 6px; }
.disc-vf-dates input { flex: 1; }
.disc-vf-code { flex: 1; display: flex; align-items: center; gap: 12px; }
.disc-vf-code > input { flex: 0 0 130px; }
.disc-vf-chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: #475569; }
.disc-vf-chk input { flex: none; width: auto; }
.disc-vf-hint { font-size: 12px; color: #64748b; line-height: 1.55; background: #f8fafc; padding: 9px 11px; border-radius: 8px; margin: 4px 0 0; }
.disc-vf-hint b { color: var(--color-primary-hover, #4338ca); }
.disc-vf-src { font-size: 13px; color: #334155; line-height: 1.6; background: var(--color-primary-bg, #eef2ff); padding: 11px 13px; border-radius: 9px; margin-bottom: 4px; }
.disc-vf-tgt { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; cursor: pointer; }
.disc-vf-tgt input { flex: none; width: auto; }

@media (max-width: 768px) {
  /* 종류 배지와 보상(% + 최대금액)을 같은 줄에 (원래/PC처럼) */
  .disc-vou-row {
    grid-template-columns: auto 1fr;
    grid-template-areas: "kind reward" "tag tag" "meta period" "copy copy";
  }
  .disc-vou-acts { grid-area: copy; justify-self: start; margin-top: 2px; }
  .disc-vf-row { flex-wrap: wrap; }
  .disc-vf-row > span:first-child { flex: 0 0 100%; }
}

/* ── 바우처: 수동/자동 소그룹 라벨 ── */
.disc-vou-sub { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; padding: 8px 14px; border-top: 2px solid; border-bottom: 1px solid; letter-spacing: .2px; }
.disc-vou-sub.manual { color: #475569; background: #f1f5f9; border-top-color: #cbd5e1; border-bottom-color: #e2e8f0; }
.disc-vou-sub.auto { color: var(--color-primary-hover, #4338ca); background: var(--color-primary-bg, #eef2ff); border-top-color: var(--color-primary-border, #c7d2fe); border-bottom-color: var(--color-primary-bg, #e0e7ff); }
.disc-vou-sub svg { flex-shrink: 0; }
.disc-vou-sclink { margin-left: auto; font-size: 11px; font-weight: 700; color: #b45309; text-decoration: none; padding: 2px 8px; border: 1px solid #fcd34d; border-radius: 6px; background: #fff; }
.disc-vou-sclink:hover { background: #fef3c7; }
/* 수동 행: 셀러센터 링크 버튼 */
.disc-vou-act.link { text-decoration: none; color: #b45309; border-color: #fcd34d; }
.disc-vou-act.link:hover { background: #fffbeb; border-color: #f59e0b; }
/* 생성 모달 안내 */
.disc-vf-note { font-size: 12px; line-height: 1.55; color: #475569; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 9px 11px; }
.disc-vf-note b { color: #1e40af; }

/* ── 상품 바우처 선택기 ── */
.disc-vf-prodrow { align-items: flex-start; }
.disc-vf-prod { flex: 1; min-width: 0; }
.disc-vf-prod > input { width: 100%; padding: 7px 10px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; margin-bottom: 6px; box-sizing: border-box; }
.disc-vf-prodlist { max-height: 180px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 8px; }
.disc-vf-proditem { display: flex; align-items: center; gap: 7px; padding: 6px 9px; font-size: 12.5px; color: #334155; border-bottom: 1px solid #f5f6f8; cursor: pointer; }
.disc-vf-proditem:last-child { border-bottom: none; }
.disc-vf-proditem input { flex: none; width: auto; }
.disc-vf-prodbase { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--color-primary-hover, #4338ca); background: var(--color-primary-bg, #eef2ff); padding: 0 5px; border-radius: 4px; flex-shrink: 0; }
.disc-vf-prodsel { font-size: 12px; color: var(--color-primary-hover, #4338ca); font-weight: 700; margin-top: 5px; }

/* 바우처 행 호버 — 배지(#eef2ff)보다 진하게 해서 배지가 안 묻히게 */
.disc-vou-row:hover { background: var(--pf-hover); }

/* ── 신규·재구매 누락 경고 (문제 샵만) ── */
.vman { border: 1.5px solid #fca5a5; border-radius: 10px; margin-bottom: 14px; overflow: hidden; background: #fff; }
.vman-bar { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: #fef2f2; color: #b91c1c; font-size: 12.5px; font-weight: 700; border-bottom: 1px solid #fecaca; }
.vman-line { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 8px 12px; border-radius: 8px; font-size: 12.5px; }
.vman-line.ok { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.vman-line.loading { background: #f8fafc; color: #94a3b8; }
.vman-recheck { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--color-primary-hover, #4338ca); background: #fff; border: 1px solid var(--color-primary-border, #c7d2fe); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.vman-recheck:hover { background: var(--color-primary-bg, #eef2ff); }
.vman-shop { padding: 9px 14px; border-bottom: 1px solid #f5f6f8; }
.vman-shop:last-child { border-bottom: none; }
.vman-shopname { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #334155; }
.vman-link { margin-left: auto; font-size: 11.5px; font-weight: 700; color: #b45309; text-decoration: none; padding: 2px 8px; border: 1px solid #fcd34d; border-radius: 6px; }
.vman-link:hover { background: #fef3c7; }
.vman-miss { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; padding-left: 26px; font-size: 12px; }
.vman-misslabel { font-weight: 700; color: #dc2626; }
.vman-refs { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; color: #64748b; }
.vman-copy { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border: 1px solid #e2e8f0; background: #fff; border-radius: 6px; font-size: 11px; color: var(--color-primary-hover, #4338ca); cursor: pointer; }
.vman-copy:hover { background: var(--color-primary-bg, #eef2ff); border-color: var(--color-primary-border, #c7d2fe); }

/* ── 모바일 보강 (2026-06-26 샵관리 모바일 다듬기) ── */
@media (max-width: 768px) {
  /* 플랫폼 윗줄 — 살짝 콤팩트하게 */
  .disc-platform-bar { margin-bottom: 6px; }

  /* 바우처 액션 버튼(자동갱신·복사·수정·종료) — 한 줄 못 들어가면 줄바꿈(가로 안 삐져나가게) */
  .disc-vou-acts { flex: none; width: 100%; flex-wrap: wrap; justify-content: flex-start; }

  /* 바우처 종류/이름 배지 글자 안 잘리게 — 말줄임(…) 끄고 전부 표시 */
  .disc-vou-kind, .disc-vou-tag {
    white-space: normal; overflow: visible; text-overflow: clip; max-width: none;
  }
  /* 보상(3% · 최대) = 종류 배지와 같은 줄 오른쪽. 공간 아껴(3% 고정폭 해제·간격↓) 한 줄에 다 들어가게,
     칸을 넘으면(아주 긴 값) 화면 밖으로 삐지는 대신 카드 안에서 …처리(off-screen 잘림 방지). */
  .disc-vou-reward { grid-area: reward; justify-self: end; margin-left: 0; justify-content: flex-end; flex-wrap: nowrap; gap: 5px; min-width: 0; }
  .disc-vou-rwd-main { flex: 0 0 auto; }
  .disc-vou-rwd-cap { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* 캠페인 일괄적용 바 — 버튼 풀폭 + 긴 설명문구는 폰에선 숨김(군더더기 제거) */
  .disc-apply-bar .disc-btn.lg { width: 100%; justify-content: center; }
  .disc-apply-hint { display: none; }
}

/* ── 캠페인 모바일 펼침 = 일괄적용 버튼만 (적용 개수는 닫힌 줄에 이미 있음) ── */
.disc-camp-mdetail { border-top: 1px solid #f1f5f9; padding: 12px 14px; }
.disc-camp-mapply { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }
/* 번들딜 탭 — 인디고 테마 */
.bd-body { padding: 4px 2px 40px; }

/* 샵 선택 — 브랜드별 줄(구분선) + 국기 */
.bd-shopsel { display: flex; flex-direction: column; background: #f8fafc; border: 1px solid #eef1f6; border-radius: 12px; padding: 4px 14px; margin-bottom: 14px; }
.bd-brandrow { display: flex; align-items: center; gap: 14px; padding: 11px 0; }
.bd-brandrow.divided { border-bottom: 1px solid #e2e8f0; }
.bd-brandname { width: 110px; font-size: 13px; font-weight: 700; color: #475569; flex-shrink: 0; }
.bd-flags { display: flex; gap: 7px; flex-wrap: wrap; }
.bd-flag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border: 1px solid #d9dee8; background: #fff; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: #475569; cursor: pointer; transition: .12s; }
.bd-flag:hover { border-color: var(--color-primary-border)/*≈#a5b4fc*/; background: var(--pf-hover); }
.bd-flag.active { background: #fff; border-color: var(--color-primary); color: var(--color-text); box-shadow: var(--pf-ring); font-weight: 700; }

/* 필터 줄 */
.bd-filters { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.bd-seg { display: inline-flex; border: 1px solid #d9dee8; border-radius: 8px; overflow: hidden; height: 36px; }
.bd-seg-btn { padding: 0 16px; border: none; background: #fff; font-size: 13px; color: #475569; cursor: pointer; border-right: 1px solid #eef1f6; }
.bd-seg-btn:last-child { border-right: none; }
.bd-seg-btn.active { background: #fff; color: var(--color-text); font-weight: 700; box-shadow: inset 0 0 0 2px var(--color-primary); }
.bd-search { min-width: 240px; }            /* 모양=전역 검색창 스타일(index.css), 높이는 인라인 36px */
.bd-count { margin-left: auto; font-size: 12.5px; color: #94a3b8; }

/* 버튼 (높이 36 통일) */
.bd-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid #d9dee8; background: #fff; border-radius: 8px; font-size: 13px; color: #475569; cursor: pointer; transition: .12s; white-space: nowrap; }
.bd-btn:hover:not(:disabled) { border-color: var(--color-primary-border)/*≈#a5b4fc*/; background: var(--pf-hover); }
.bd-btn.primary { background: var(--color-primary)/*≈#4f46e5*/; border-color: var(--color-primary)/*≈#4f46e5*/; color: #fff; font-weight: 600; }
.bd-btn.primary:hover:not(:disabled) { background: var(--color-primary-hover)/*≈#4338ca*/; }
.bd-btn.danger { background: #fff; border-color: #fca5a5; color: #dc2626; }
.bd-btn.danger:hover:not(:disabled) { background: #fef2f2; }
.bd-btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.bd-btn:disabled { opacity: .5; cursor: not-allowed; }
.bd-link { background: none; border: none; color: var(--color-primary)/*≈#4f46e5*/; font-size: 12.5px; cursor: pointer; font-weight: 600; margin-left: 8px; }
.bd-spin { animation: bd-spin 1s linear infinite; }
@keyframes bd-spin { to { transform: rotate(360deg); } }

.bd-empty { padding: 48px 0; text-align: center; color: #94a3b8; font-size: 14px; }
.bd-empty.sm { padding: 18px 0; font-size: 13px; }

/* 목록 = 열 정렬 grid (썸네일 5칸 고정) */
.bd-list { display: flex; flex-direction: column; gap: 10px; }
.bd-card { display: grid; grid-template-columns: 270px 1fr auto 162px 60px auto; gap: 16px; align-items: center;
  padding: 14px 20px; border: 1.5px solid #cbd5e1; border-radius: 12px; background: #fff; cursor: pointer; transition: .12s; }
.bd-col-rule { justify-self: end; }   /* 배지를 기간 쪽으로 붙임 */
.bd-card:hover { border-color: var(--color-primary)/*≈#6366f1*/; background: var(--pf-hover); box-shadow: 0 2px 14px rgba(79,70,229,.16); }
.bd-col-thumbs { display: flex; gap: 5px; }
.bd-thumb { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; border: 1px solid #eef1f6; background: #f8fafc; flex-shrink: 0; }
.bd-thumb.empty { display: flex; align-items: center; justify-content: center; color: #cbd5e1; }
.bd-thumb.blank { background: #f8fafc; border: 1px dashed #e2e8f0; }
.bd-thumb.more { display: flex; align-items: center; justify-content: center; background: var(--color-primary-bg)/*≈#eef2ff*/; color: var(--color-primary)/*≈#4f46e5*/; font-weight: 700; font-size: 12px; border-color: var(--color-primary-border)/*≈#c7d2fe*/; }
.bd-col-name { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.bd-card-line1 { display: flex; align-items: center; gap: 8px; }
.bd-card-name { font-size: 15px; font-weight: 700; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-card-memo { font-size: 12.5px; color: var(--color-primary)/*≈#6366f1*/; background: #f5f3ff; padding: 3px 9px; border-radius: 6px; align-self: flex-start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-col-period { font-size: 12.5px; color: #64748b; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.bd-col-cnt { font-size: 12px; color: #64748b; text-align: center; line-height: 1.45; }
.bd-col-cnt b { font-size: 15px; color: #1e293b; }

/* 할인 배지 — 카드에선 한 줄 (줄바꿈 X) */
.bd-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.bd-col-rule .bd-badges { flex-wrap: nowrap; overflow: hidden; }
.bd-badge { display: inline-flex; align-items: center; gap: 4px; background: #eef1f6; border: 1px solid #cbd5e1; padding: 4px 11px; border-radius: 8px; font-size: 13px; white-space: nowrap; }
.bd-badge-qty { color: #334155; font-weight: 800; font-size: 13.5px; }
.bd-badge-arr { color: #cbd5e1; }
.bd-badge-disc { color: #b91c1c; font-weight: 800; font-size: 14.5px; }

.bd-state { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px; white-space: nowrap; }
.bd-state.ongoing { background: #dcfce7; color: #16a34a; }
.bd-state.upcoming { background: #fef9c3; color: #ca8a04; }
.bd-state.expired { background: #f1f5f9; color: #94a3b8; }

/* 옵션 개수 칩 */
.bd-opt { display: inline-block; margin-left: 7px; font-size: 11px; color: #7c3aed; background: #f3e8ff; padding: 1px 7px; border-radius: 999px; font-weight: 600; }

/* 모달 */
.bd-modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.bd-modal { background: #fff; border-radius: 16px; width: 100%; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: 92vh; }
.bd-modal.create { max-width: 1340px; height: 88vh; }
.bd-modal.manage { max-width: 900px; }
.bd-modal.create .bd-modal-scroll { overflow: hidden; }   /* 이중 스크롤 방지 — 안쪽 칸이 각자 스크롤 */
.bd-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid #eef1f6; }
.bd-modal-head h3 { margin: 0; font-size: 17px; color: #1e293b; display: flex; align-items: center; gap: 9px; }
.bd-x { background: none; border: none; color: #94a3b8; cursor: pointer; padding: 2px; border-radius: 6px; }
.bd-x:hover { background: #f1f5f9; color: #475569; }
.bd-modal-scroll { padding: 20px 24px; overflow-y: auto; flex: 1; }
.bd-modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid #eef1f6; }

/* 생성 모달 = 2단 (각 칸 독립 스크롤, 상품 칸이 남는 높이 꽉 채움) */
.bd-create-grid { display: grid; grid-template-columns: 1fr 660px; gap: 24px; min-height: 0; }
.bd-create-left { overflow-y: auto; min-height: 0; padding-right: 8px; }
.bd-create-right { border-left: 1px solid #eef1f6; padding-left: 22px; display: flex; flex-direction: column; min-height: 0; }
.bd-create-right .bd-picker { flex: 1; }
.bd-create-right .bd-picker-grid { flex: 1; max-height: none; grid-template-columns: repeat(3, 1fr); }   /* 딱 3열 + 공간 꽉 채워 스크롤 */
.bd-picker-label { font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 8px; display: block; }

.bd-field { margin-bottom: 18px; }
.bd-field > label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 8px; }
.bd-sub { font-weight: 400; color: #94a3b8; font-size: 12px; }
.bd-field input:not([placeholder*="검색"]) { width: 100%; padding: 9px 12px; border: 1px solid #d9dee8; border-radius: 8px; font-size: 14px; color: #1e293b; box-sizing: border-box; }
.bd-field input:focus { outline: none; border-color: var(--color-primary-border)/*≈#a5b4fc*/; }
.bd-field-row { display: flex; gap: 12px; }
.bd-field-row .bd-field { flex: 1; }

.bd-ruletypes { display: flex; flex-direction: column; gap: 7px; }
.bd-ruletype { display: flex; flex-direction: column; gap: 2px; padding: 10px 13px; border: 1px solid #d9dee8; border-radius: 9px; background: #fff; cursor: pointer; text-align: left; }
.bd-ruletype b { font-size: 13.5px; color: #1e293b; }
.bd-ruletype span { font-size: 11.5px; color: #94a3b8; }
.bd-ruletype.active { border-color: var(--color-primary)/*≈#4f46e5*/; background: var(--color-primary-bg)/*≈#eef2ff*/; }
.bd-ruletype.active b { color: var(--color-primary)/*≈#4f46e5*/; }

.bd-tiers { display: flex; flex-direction: column; gap: 8px; }
.bd-tier { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #475569; }
.bd-tier-n { font-weight: 700; color: var(--color-primary)/*≈#4f46e5*/; width: 30px; }
.bd-tier-min { width: 64px !important; text-align: center; }
.bd-tier-v { width: 110px !important; }
.bd-tier-unit { color: #64748b; font-weight: 600; }
.bd-tier-del { background: none; border: none; color: #f87171; cursor: pointer; padding: 4px; }
.bd-tier-add { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; background: none; border: 1px dashed var(--color-primary-border)/*≈#c7d2fe*/; color: var(--color-primary)/*≈#4f46e5*/; padding: 6px 12px; border-radius: 7px; font-size: 12.5px; cursor: pointer; }

/* 상품 선택기 (사진 격자) */
.bd-picker { border: 1px solid #eef1f6; border-radius: 10px; padding: 10px; background: #fafbff; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.bd-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 11px; overflow-y: auto; max-height: 360px; align-content: start; }
.bd-pick { position: relative; border: 1.5px solid #cbd5e1; border-radius: 10px; background: #fff; padding: 9px; cursor: pointer; text-align: left; transition: .1s; }
.bd-pick:hover { border-color: var(--color-primary)/*≈#6366f1*/; background: var(--pf-hover); }
.bd-pick.on { border-color: var(--color-primary)/*≈#4f46e5*/; background: var(--color-primary-bg)/*≈#eef2ff*/; }
.bd-pick img { width: 100%; height: 150px; object-fit: contain; border-radius: 7px; background: #f8fafc; }   /* contain = 사진 안 잘림 */
.bd-pick-noimg { width: 100%; height: 150px; display: flex; align-items: center; justify-content: center; color: #cbd5e1; background: #f8fafc; border-radius: 7px; }
.bd-pick-name { font-size: 12.5px; color: #334155; margin-top: 7px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 34px; }
.bd-pick-meta { font-size: 11.5px; color: #94a3b8; display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 4px; }
.bd-pick-meta .bd-opt { margin-left: 0; font-size: 10px; padding: 0 6px; }
.bd-pick-check { position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; background: var(--color-primary)/*≈#4f46e5*/; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; }

/* 관리 모달 */
.bd-mg-info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; background: #f8fafc; padding: 14px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px; color: #334155; align-items: center; }
.bd-mg-rule { display: flex; align-items: center; }
.bd-mg-k { color: #94a3b8; font-size: 12px; margin-right: 8px; }
.bd-note { background: #fffbeb; border: 1px solid #fde68a; color: #b45309; font-size: 12.5px; padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; }
.bd-add-box { margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.bd-add-box .bd-btn { align-self: flex-start; }
.bd-mg-items { display: flex; flex-direction: column; gap: 7px; }
.bd-mg-item { display: flex; align-items: center; gap: 12px; padding: 8px 11px; border: 1.5px solid #cbd5e1; border-radius: 9px; transition: .1s; }
.bd-mg-item:hover { border-color: var(--color-primary)/*≈#6366f1*/; background: var(--pf-hover); }
.bd-mg-item img, .bd-noimg { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #f8fafc; }
.bd-noimg { display: flex; align-items: center; justify-content: center; color: #cbd5e1; }
.bd-mg-item-txt { flex: 1; min-width: 0; }
.bd-mg-item-name { font-size: 13.5px; color: #1e293b; }
.bd-mg-item-sku { font-size: 11.5px; color: #94a3b8; display: flex; align-items: center; }
.bd-mg-rm { background: none; border: none; color: #f87171; cursor: pointer; padding: 6px; border-radius: 6px; }
.bd-mg-rm:hover { background: #fef2f2; }

.bd-err { color: #dc2626; font-size: 12.5px; margin-right: auto; }
.bd-msg { color: #16a34a; font-size: 12.5px; margin-right: auto; }

@media (max-width: 820px) {
  /* 샵 선택 — 모든 브랜드 통일: 브랜드명 윗줄 / 국가버튼 아랫줄 (동글만 옆에 붙던 문제 해결) */
  .bd-shopsel { padding: 4px 10px; }
  .bd-brandrow { flex-direction: column; align-items: flex-start; gap: 6px; padding: 9px 0; }
  .bd-brandname { width: auto; font-size: 12px; }
  .bd-flags { gap: 6px; }
  .bd-flag { padding: 6px 13px; font-size: 12.5px; }

  /* 검색 글자 작게 (필터 + 모달 picker 둘 다) */
  .bd-search { font-size: 13px; }
  /* '빈 공간 채우기'(flex)는 필터 검색창에만 — 가로로만 늘어남 */
  .bd-filters .bd-search { min-width: 0; flex: 1 1 140px; }
  /* 🔴 모달 picker 검색창은 세로 박스 안이라 flex 주면 세로로 거대해짐 → 높이 고정(34px) */
  .bd-picker .bd-search { flex: none; }

  /* 번들 카드 — 좁은 화면에선 위→아래로 쌓기 (가로 안 삐져나가게) */
  .bd-card { display: flex; flex-direction: column; align-items: stretch; gap: 11px; padding: 14px 16px; }
  .bd-col-thumbs { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }  /* 썸네일 5칸은 가로 스크롤 */
  .bd-col-name { min-width: 0; }
  .bd-col-rule { justify-self: stretch; }
  .bd-col-rule .bd-badges { flex-wrap: wrap; overflow: visible; }   /* 할인 배지 줄바꿈 허용 */
  .bd-col-period, .bd-col-cnt { text-align: left; justify-content: flex-start; }
  .bd-col-acts { justify-content: flex-start; flex-wrap: wrap; }    /* 자동갱신/복사/종료 버튼 줄바꿈 */

  /* ═══════════ 모달 모바일 = 일반 블록 스택 ═══════════
     flex/grid 는 공간 부족 시 칸을 '눌러서' 글자가 삐져나와 겹침 → 보통 문서 흐름(display:block)으로.
     블록은 칸을 절대 안 누르고(찌그러짐 0) 안 겹침. 각 칸이 자기 높이 그대로 차지하고 위→아래로 쌓임.
     내용이 길면 본문(.bd-modal-scroll)이 통째로 스크롤. */

  /* 모달 박스 — 폰 화면 거의 꽉 */
  .bd-modal-bg { padding: 8px; }
  .bd-modal.create, .bd-modal.manage, .bd-modal.manage.addmode { height: 94vh; max-height: 94vh; }
  .bd-modal-head { padding: 14px 16px; }
  .bd-modal-foot { padding: 12px 16px; }

  /* 본문 = 스크롤 영역 하나 (블록 흐름). min-height:0 = flex자식이라 줄어들어 스크롤되게. */
  .bd-modal-scroll,
  .bd-modal.create .bd-modal-scroll,
  .bd-modal.manage.addmode .bd-modal-scroll {
    display: block; min-height: 0;
    overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
    padding: 14px 16px;
  }

  /* 본문 내부 = 그냥 블록으로 쌓기 (절대 안 눌리고 안 겹침) */
  .bd-create-grid { display: block; }
  .bd-create-left, .bd-create-right {
    display: block; width: 100%; min-width: 0; overflow: visible; padding: 0; border: none;
  }
  .bd-create-right { margin-top: 16px; border-top: 1px solid #eef1f6; padding-top: 14px; }
  .bd-mg-2col { display: block; }
  .bd-mg-2col-right { display: block; margin-top: 14px; border: none; padding: 0; }
  .bd-mg-info { grid-template-columns: 1fr; }

  /* 시작일·종료일·개수 — 날짜칸이 안 줄어 가로 넘침 → 세로로 */
  .bd-field-row { flex-direction: column; gap: 14px; }
  .bd-field-row .bd-field { width: 100%; }

  /* 상품 선택기 = 일반 블록 + 3칸 격자 (자체 스크롤 없음 → 모달 본문이 통째 스크롤) */
  .bd-picker { display: block; background: none; border: none; padding: 0; }
  .bd-picker-grid,
  .bd-create-right .bd-picker-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px;
    max-height: none; overflow: visible;
  }
  .bd-pick { padding: 6px; border-radius: 9px; min-width: 0; }   /* min-width:0 = 오른쪽 잘림 차단 */
  .bd-pick img, .bd-pick-noimg { height: 92px; }
  .bd-pick-name { font-size: 11px; margin-top: 5px; min-height: 30px; line-height: 1.3; }
  .bd-pick-meta { font-size: 10px; margin-top: 3px; min-width: 0; }
  .bd-pick-meta .bd-opt { flex-shrink: 0; }
  .bd-pick-check { width: 18px; height: 18px; font-size: 11px; }

  .bd-count { margin-left: 0; }
}

/* ===== 추가 (자동갱신·2단추가·복사·회색) ===== */
.bd-auto-chip { font-size: 10.5px; font-weight: 700; color: #0891b2; background: #cffafe; padding: 2px 7px; border-radius: 5px; }

/* 선택기 회색(이미 사용) */
.bd-pick.used { opacity: .5; cursor: not-allowed; }
.bd-pick.used:hover { border-color: #e2e8f0; }
.bd-pick-usedtag { position: absolute; top: 5px; left: 5px; background: #f59e0b; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 5px; }

/* 자동갱신 토글 */
.bd-mg-auto { display: flex; align-items: center; gap: 8px; }
.bd-toggle { width: 38px; height: 22px; border-radius: 999px; border: none; background: #cbd5e1; position: relative; cursor: pointer; transition: .15s; flex-shrink: 0; }
.bd-toggle.on { background: var(--color-primary)/*≈#4f46e5*/; }
.bd-toggle-dot { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .15s; }
.bd-toggle.on .bd-toggle-dot { left: 18px; }
.bd-toggle-label { font-size: 12px; color: #64748b; }

/* 상품추가 2단 */
.bd-modal.manage.wide { max-width: 1140px; }
.bd-mg-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.bd-mg-2col-left, .bd-mg-2col-right { display: flex; flex-direction: column; min-width: 0; }
.bd-mg-2col-right { border-left: 1px solid #eef1f6; padding-left: 18px; }
.bd-2col-title { font-size: 12.5px; font-weight: 700; color: #475569; margin-bottom: 9px; }
.bd-mg-2col .bd-mg-items { max-height: 420px; overflow-y: auto; }

/* 복사 모달 */
.bd-modal.copy { max-width: 560px; }
.bd-copy-hint { font-size: 13px; color: #475569; background: #f8fafc; padding: 11px 14px; border-radius: 9px; margin-bottom: 14px; line-height: 1.5; }
.bd-copy-targets { display: flex; flex-direction: column; gap: 8px; }
.bd-copy-target { display: flex; align-items: center; gap: 9px; padding: 11px 14px; border: 1px solid #d9dee8; background: #fff; border-radius: 9px; font-size: 13.5px; color: #334155; cursor: pointer; text-align: left; }
.bd-copy-target:hover { border-color: var(--color-primary-border)/*≈#a5b4fc*/; background: var(--pf-hover); }
.bd-copy-target.on { border-color: var(--color-primary)/*≈#4f46e5*/; background: var(--color-primary-bg)/*≈#eef2ff*/; }
.bd-pick-check.sm { position: static; width: 18px; height: 18px; margin-left: auto; font-size: 11px; }
.bd-copy-results { display: flex; flex-direction: column; gap: 8px; }
.bd-copy-result { font-size: 13px; padding: 10px 13px; border-radius: 8px; }
.bd-copy-result.ok { background: #f0fdf4; color: #166534; }
.bd-copy-result.fail { background: #fef2f2; color: #991b1b; }

/* ===== 카드 액션(자동갱신 토글 + 복사) ===== */
.bd-col-acts { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.bd-card-auto { display: flex; align-items: center; gap: 6px; }
.bd-card-auto-lbl { font-size: 11px; color: #94a3b8; }
.bd-col-acts .bd-btn.sm { height: 30px; padding: 0 10px; }

/* ===== 관리 모달 '상품 추가' 모드 = 만들기처럼 크게 ===== */
.bd-modal.manage.addmode { max-width: 1340px; height: 88vh; }
.bd-modal.manage.addmode .bd-modal-scroll { overflow: hidden; }
.bd-modal.manage.addmode .bd-create-left .bd-mg-items { overflow-y: auto; }

/* ===== 카드 액션 한 줄 + 바우처 스타일 버튼 ===== */
.bd-col-acts { display: flex; flex-direction: row; align-items: center; justify-content: flex-end; gap: 6px; }
.bd-renew { display: inline-flex; align-items: center; gap: 3px; height: 28px; padding: 0 9px; border: 1px solid #e2e8f0; background: #fff; border-radius: 7px; font-size: 11px; font-weight: 800; color: #94a3b8; cursor: pointer; white-space: nowrap; }
.bd-renew.on { background: #dcfce7; border-color: #86efac; color: #15803d; }
.bd-copy-btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border: 1px solid #e2e8f0; background: #fff; border-radius: 7px; font-size: 11.5px; font-weight: 600; color: var(--color-primary-hover)/*≈#4338ca*/; cursor: pointer; white-space: nowrap; }
.bd-copy-btn:hover { background: var(--pf-hover); border-color: var(--color-primary-border)/*≈#c7d2fe*/; }

/* ===== 이익률 표시 ===== */
.bd-mgl { display: flex; flex-wrap: wrap; gap: 3px 10px; margin-top: 4px; font-size: 11.5px; color: #64748b; align-items: center; }
.bd-mgl-cur { color: #475569; }
.bd-mgl-pct { font-weight: 800; color: #16a34a; }
.bd-mgl-pct.low { color: #b91c1c; }
.bd-mgl-krw { color: #94a3b8; font-size: 11px; }
.bd-mg-noprice { font-size: 11.5px; color: #d97706; margin-top: 4px; display: inline-block; }
.bd-mg-load { font-size: 11.5px; color: #cbd5e1; margin-top: 4px; display: inline-block; }
.bd-mg-summary-row { grid-column: 1 / -1; padding-top: 9px; border-top: 1px dashed #e2e8f0; margin-top: 2px; }
.bd-mg-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; }
.bd-mg-sum .bd-mg-k { margin-right: 0; }
.bd-mg-sumt { color: #64748b; }
.bd-mg-sumk { color: #94a3b8; font-size: 12.5px; }
.bd-foot-margin { margin-right: auto; min-width: 0; overflow: hidden; }

/* 카드 종료/삭제 버튼 (빨강) */
.bd-end-btn { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border: 1px solid #fecaca; background: #fff; border-radius: 7px; font-size: 11.5px; font-weight: 700; color: #dc2626; cursor: pointer; white-space: nowrap; }
.bd-end-btn:hover { background: #fef2f2; border-color: #fca5a5; }

/* 브랜드 배지 (품명 앞) */
.bd-brand { display: inline-block; font-size: 10px; font-weight: 700; color: var(--color-primary-hover)/*≈#4338ca*/; background: var(--color-primary-bg)/*≈#eef2ff*/; border: 1px solid var(--color-primary-border)/*≈#c7d2fe*/; padding: 1px 5px; border-radius: 5px; margin-right: 5px; vertical-align: middle; white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════════════
   📱 모바일 모달 최종 보정 (파일 맨 끝 = 모든 base 규칙보다 뒤 → 순서상 무조건 이김)
   여기 두 개만 위쪽 모바일 블록과 떨어뜨려 둔 이유:
   위쪽 블록(153~226) 뒤에 오는 base 규칙(line 272·273)이 그걸 덮어써서,
   확실히 이기려면 '모든 base 보다 뒤'인 여기에 둬야 함.
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 820px) {
  /* #2 상품추가 모달 — base의 overflow:hidden(스크롤 막기)을 풀어 만들기처럼 본문 통째 스크롤 */
  .bd-modal.manage.addmode .bd-modal-scroll {
    overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  }
  .bd-modal.manage.addmode { height: 94vh; }

  /* #1 iOS 날짜칸(시작일/종료일)이 width:100% 무시하고 우측으로 넘침 →
     기본 외형 제거(appearance:none)로 일반 입력칸처럼: 칸에 딱 맞고(넘침0) 글자 좌측정렬(휑함 해소). */
  .bd-field input[type="date"] {
    -webkit-appearance: none; appearance: none;
    width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box;
    text-align: left; font-size: 14px;
  }
}

/* 사용중 뱃지 2개 — (사용중)(번들이름), 말줄임 없이 전체 표시 (형 7/28) */
.bd-pick-usedwrap { position: absolute; top: 5px; left: 5px; display: flex; gap: 3px; flex-wrap: wrap; max-width: calc(100% - 10px); z-index: 1; }
.bd-pick-usedwrap .bd-pick-usedtag { position: static; }
.bd-pick-usedname { background: #334155; color: #fff; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 5px; }

/* 구성 상품 안 검색 */
.bd-mg-search { height: 32px; box-sizing: border-box; width: 100%; margin-bottom: 8px; }

/* hover 마진 미리보기 카드 */
.bd-margintip { position: fixed; z-index: 10000; width: 300px; max-height: 350px; overflow: auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.16); padding: 10px 12px; font-size: 12px; }
.bd-mt-tier { margin-bottom: 8px; }
.bd-mt-tierhead { font-weight: 700; color: #334155; margin-bottom: 4px; }
.bd-mt-table { width: 100%; border-collapse: collapse; }
.bd-mt-table th { text-align: left; color: #94a3b8; font-weight: 600; padding: 2px 4px; border-bottom: 1px solid #f1f5f9; }
.bd-mt-table td { padding: 2px 4px; border-bottom: 1px solid #f8fafc; white-space: nowrap; }
.bd-mt-table td.neg { color: #dc2626; font-weight: 700; }
.bd-mt-note { color: #94a3b8; font-size: 10.5px; margin-top: 4px; }

/* 관리 모달 높이 고정 — 구성상품 검색 시 창 크기 널뛰기 방지 (형 지적 7/28). 안쪽만 스크롤 */
.bd-modal.manage { height: 88vh; }

/* 이익률 pill — 소싱탭 색 언어, 경계만 형 기준(10% 미만 = 빨강) */
.bd-mr-pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-weight: 700; }
.bd-mr-pill.mr-grn { background: #d1fae5; color: #065f46; }
.bd-mr-pill.mr-blu { background: #dbeafe; color: #1e40af; }
.bd-mr-pill.mr-org { background: #fed7aa; color: #9a3412; }
.bd-mr-pill.mr-red { background: #fecaca; color: #991b1b; }
/* 품절 관리 탭 — ERP 테마 변수(--color-*) 기반 */
.st-body { padding: 4px 2px 60px; }

/* 브랜드 선택 */
.st-brandsel { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.st-brand { padding: 9px 20px; border: 1.5px solid var(--color-border); background: var(--color-surface);
  border-radius: 9px; font-size: 14.5px; font-weight: 600; color: var(--color-text-dim); cursor: pointer; transition: .12s; }
.st-brand:hover { border-color: var(--color-primary); color: var(--color-primary); }
.st-brand.active { background: #fff; border-color: var(--color-primary); color: var(--color-text); box-shadow: var(--pf-ring); font-weight: 700; }

/* 필터줄 */
.st-filters { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.st-search { height: 36px; box-sizing: border-box; padding: 0 12px; border: 1px solid var(--color-border);
  border-radius: 8px; font-size: 14px; min-width: 200px; flex: 0 1 260px; color: var(--color-text); }
.st-search:focus { border-color: var(--color-primary); outline: none; }
.st-statusseg { display: inline-flex; border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; }
.st-seg-btn { padding: 0 14px; height: 36px; border: none; background: var(--color-surface); font-size: 13px;
  font-weight: 600; color: var(--color-text-secondary); cursor: pointer; border-right: 1px solid var(--color-border); }
.st-seg-btn:last-child { border-right: none; }
.st-seg-btn:hover { background: var(--pf-hover); }
.st-seg-btn.active { background: #fff; color: var(--color-text); font-weight: 700; box-shadow: inset 0 0 0 2px var(--color-primary); }
.st-count { margin-left: auto; font-size: 13px; color: var(--color-text-secondary); }

.st-btn { display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 14px;
  border: 1px solid var(--color-border); background: var(--color-surface); border-radius: 8px; font-size: 13px;
  font-weight: 600; color: var(--color-text-dim); cursor: pointer; transition: .12s; white-space: nowrap; }
.st-btn:hover:not(:disabled) { background: var(--pf-hover); border-color: var(--color-primary-border); }
.st-btn.primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.st-btn.primary:hover:not(:disabled) { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.st-btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.st-btn:disabled { opacity: .45; cursor: default; }
.st-spin { animation: st-rot 1s linear infinite; }
@keyframes st-rot { to { transform: rotate(360deg); } }

.st-empty { padding: 50px 0; text-align: center; color: var(--color-text-muted); font-size: 14px; }
.st-more { text-align: center; padding: 14px; color: var(--color-text-muted); font-size: 12.5px; }
.st-editbar { display: flex; align-items: center; gap: 6px; background: var(--color-primary-bg);
  color: var(--color-primary-hover); border: 1px solid var(--color-primary-border); border-radius: 8px;
  padding: 7px 12px; font-size: 12.5px; font-weight: 600; margin-bottom: 10px; }

/* 그룹 카드 — 교차 배경(가독성) */
.st-list { display: flex; flex-direction: column; gap: 6px; }
.st-card { border: 1px solid var(--color-border); border-radius: 11px; background: var(--color-surface); overflow: hidden; transition: .12s;
  content-visibility: auto; contain-intrinsic-size: auto 60px; }   /* 화면 밖 카드는 렌더 스킵 → 스크롤 렉 해소 */
.st-card:hover { border-color: var(--color-primary-border); }
.st-card.open { border-color: var(--color-primary-border); box-shadow: 0 2px 12px rgba(99,102,241,.08); }
.st-card:nth-child(even) .st-card-head { background: var(--color-primary-bg); }   /* 그룹 행(헤더)에만 인디고 교차색 */

/* 헤더 = 한 줄: 썸네일 · SKU번호 · 브랜드 · 품명+옵션배지 ··· 상태배지 · 전체적용 · 펼침 */
.st-card-head { display: flex; align-items: center; gap: 10px; padding: 10px 13px; cursor: pointer; }
.st-card-head:hover, .st-card:nth-child(even) .st-card-head:hover { background: var(--color-row-hover); }   /* 교차색보다 진한 인디고 → 호버 구분 (even 헤더도 호버 적용) */
.st-thumb { width: 46px; height: 46px; border-radius: 7px; object-fit: cover; background: #f1f2f4; flex: 0 0 auto; }
.st-base { font-size: 16px; font-weight: 700; color: var(--color-text); flex: 0 0 auto; min-width: 56px; }
.st-brand-badge { font-size: 12px; font-weight: 600; color: var(--color-primary-hover); background: #fff;
  border: 1px solid var(--color-primary-border); border-radius: 6px; padding: 2px 9px; flex: 0 0 auto;
  min-width: 76px; max-width: 120px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-name { font-size: 14.5px; color: var(--color-text); flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-optcount-badge { font-size: 12px; font-weight: 600; color: var(--color-primary-hover); background: #fff;
  border: 1px solid var(--color-primary-border); border-radius: 20px; padding: 2px 10px; flex: 0 0 auto; white-space: nowrap; }
.st-status-badge { font-size: 12.5px; font-weight: 700; padding: 4px 0; border-radius: 20px; flex: 0 0 auto;
  margin-left: auto; min-width: 70px; text-align: center; }
.st-status-badge.ok { background: #e7f6ee; color: #0a8a4a; }
.st-status-badge.warn { background: #fdf0dd; color: #c2740a; }
.st-status-badge.bad { background: #fde7e7; color: #d32f2f; }
.st-chev { color: var(--color-text-muted); flex: 0 0 auto; }

/* 옵션 펼침 — 행마다 구분선 + 호버 */
.st-card-body { border-top: 1px solid var(--color-border); padding: 0 8px 6px; background: var(--color-surface); }   /* 옵션 영역은 흰색(인디고 안 깔림) */
.st-opt { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--color-border); transition: background .1s; }
.st-opt:nth-child(even) { background: var(--color-row-zebra); }   /* 하위 옵션은 원래대로 회색 교차색 */
.st-opt:hover { background: var(--color-row-hover); }
.st-opt.sold { background: #fff3f3; }
.st-opt.sold:hover { background: #ffe9e9; }
.st-opt.changed { background: var(--color-row-hover); }
.st-opt-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: #f1f2f4; flex: 0 0 auto; }
.st-opt-sku { font-size: 13.5px; font-weight: 700; color: var(--color-text-dim); flex: 0 0 auto; min-width: 78px; }
.st-opt-name { font-size: 13px; color: var(--color-text-secondary); flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-mixed { font-size: 10.5px; font-weight: 600; color: #c2740a; background: #fdf0dd; border-radius: 5px; padding: 1px 6px; flex: 0 0 auto; }
.st-opt-input { width: 82px; height: 34px; box-sizing: border-box; text-align: center; font-size: 14px; font-weight: 600;
  border: 1.5px solid var(--color-border); border-radius: 7px; flex: 0 0 auto; color: var(--color-text); background: #fff; }
.st-opt-input:focus { border-color: var(--color-primary); outline: none; }
.st-opt-input.locked { background: #f1f3f7; color: var(--color-text-muted); cursor: pointer; border-style: dashed; }
.st-opt-input.locked:hover { border-color: var(--color-primary-border); }
.st-opt.sold .st-opt-input { border-color: #f0a0a0; color: #d32f2f; }
.st-opt-badge { font-size: 12px; font-weight: 700; padding: 4px 0; border-radius: 20px; flex: 0 0 auto; min-width: 60px; text-align: center; }
.st-opt-badge.ok { background: #e7f6ee; color: #0a8a4a; }
.st-opt-badge.bad { background: #fde7e7; color: #d32f2f; }

/* 저장 푸터 — 위에 구분선 */
.st-card-foot { display: flex; align-items: center; gap: 12px; padding: 11px 6px 4px; border-top: 1px solid var(--color-border); margin-top: 2px; }
.st-changed-n { margin-left: auto; font-size: 12.5px; color: var(--color-primary-hover); font-weight: 600; }

/* 전체적용 팝오버 (버튼에 붙음) */
.st-pop-bg { position: fixed; inset: 0; z-index: 8999; }
.st-pop { z-index: 9000; background: #fff; border: 1px solid var(--color-border); border-radius: 11px;
  box-shadow: 0 8px 28px rgba(15,23,42,.18); padding: 12px; animation: st-pop-in .13s ease-out; transform-origin: top right; }
@keyframes st-pop-in { from { opacity: 0; transform: scale(.92) translateY(-4px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.st-pop-title { font-size: 13px; font-weight: 700; color: var(--color-text); margin-bottom: 8px; }
.st-pop-hint { font-size: 11px; font-weight: 600; color: var(--color-text-muted); margin-left: 4px; }
.st-pop-row { display: flex; gap: 7px; align-items: center; flex-wrap: nowrap; }
.st-pop-input { flex: 1 1 auto; min-width: 0; height: 36px; box-sizing: border-box; text-align: center; font-size: 15px; font-weight: 700;
  border: 1.5px solid var(--color-border); border-radius: 8px; color: var(--color-text); }
.st-pop-input:focus { border-color: var(--color-primary); outline: none; }
.st-pop-btn { flex: 0 0 auto; height: 36px; padding: 0 16px; border: none; border-radius: 8px; background: var(--color-primary);
  color: #fff; font-size: 13.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.st-pop-btn:hover:not(:disabled) { background: var(--color-primary-hover); }
.st-pop-btn:disabled { opacity: .45; cursor: default; }

/* 중앙 모달(확인/결과) */
.st-modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.st-modal { background: #fff; border-radius: 14px; width: 100%; max-width: 440px; padding: 22px; box-shadow: 0 16px 48px rgba(0,0,0,.22); }
.st-modal h3 { margin: 0 0 8px; font-size: 17px; display: flex; align-items: center; gap: 6px; color: var(--color-text); }
.st-modal-desc { margin: 0 0 14px; font-size: 13px; color: var(--color-text-secondary); line-height: 1.55; }
.st-modal-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.st-confirm-list, .st-fail-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--color-border); border-radius: 9px; }
.st-confirm-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; }
.st-confirm-row:nth-child(even) { background: var(--color-row-zebra); }
.st-fail-row { padding: 9px 12px; border-bottom: 1px solid #f3f4f6; }
.st-fail-row:last-child { border-bottom: none; }
.st-fail-top { display: flex; gap: 8px; align-items: center; margin-bottom: 3px; }
.st-fail-shop { font-size: 12px; color: var(--color-text-secondary); }
.st-fail-reason { font-size: 12.5px; color: #b54708; line-height: 1.5; }

/* 모바일 */
@media (max-width: 640px) {
  .st-search { flex: 1 1 100%; min-width: 0; }
  .st-statusseg { flex: 1 1 auto; }
  .st-seg-btn { flex: 1 1 auto; }
  .st-count { margin-left: 0; }
  .st-card-head { flex-wrap: wrap; gap: 7px 8px; }
  .st-base { min-width: 44px; }
  .st-name { flex: 1 1 100%; order: 5; }
  .st-status-badge { order: 6; margin-left: 0; }
  .st-optcount-badge { order: 7; }
  .st-btn.sm { order: 8; margin-left: auto; }
  .st-opt { flex-wrap: wrap; }
  .st-opt-name { flex: 1 1 100%; order: 5; padding-left: 50px; }
}

/* 모바일 = 교차색(줄무늬) 전부 제거 — 좁은 화면에선 얼룩처럼 보임 (형 지시 7/28). PC 는 유지 */
@media (max-width: 640px) {
  .st-card:nth-child(even) .st-card-head { background: transparent; }
  .st-opt:nth-child(even) { background: transparent; }
  .st-confirm-row:nth-child(even) { background: transparent; }
}
.br-page { padding: 16px 28px 40px; max-width: 1600px; margin: 0 auto; }
/* 맨 위에서 제목/단계가 고정헤더 커버(::before) 위로 보이게 */
.br-head { position: relative; z-index: 20; background: var(--color-bg); }
.br-head h1 { font-size: 22px; font-weight: 800; margin: 0 0 14px; }

.br-steps { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.br-step { display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px;
  background: var(--color-surface, #f4f5f7); color: var(--color-text-secondary, #888); font-size: 13px; font-weight: 600; }
.br-step.active { background: var(--color-primary, #ee4d2d); color: #fff; }
.br-step.done { background: #10b98122; color: #10b981; }
.br-step-n { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 50%; background: rgba(0,0,0,.12); font-size: 12px; font-weight: 800; }
.br-step.active .br-step-n { background: rgba(255,255,255,.3); }

/* 상단 고정 헤더 — 완전 불투명 + 풀블리드(좌우 끝까지) + 위쪽 틈 커버(::before)로 카드 비침 제거 */
.br-stickyhead { position: sticky; top: 0; z-index: 10; background: var(--color-bg);
  margin: 0 -28px; padding: 12px 28px 8px; box-shadow: 0 8px 12px -10px rgba(0,0,0,.22); }
.br-stickyhead::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%;
  height: 500px; background: var(--color-bg); }
.br-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.br-brandsel { display: flex; gap: 6px; flex-wrap: wrap; }
.br-brand { padding: 8px 14px; border-radius: 9px; border: 1.5px solid var(--color-border, #e3e5e8);
  background: #fff; color: var(--color-text, #333); font-size: 13px; font-weight: 600; cursor: pointer; }
.br-brand.active { border-color: var(--color-primary, #ee4d2d); background: var(--color-primary, #ee4d2d); color: #fff; }
.br-search { flex: 1 1 200px; min-width: 150px; max-width: 440px; padding: 9px 13px; border: 1.5px solid var(--color-border, #e3e5e8);
  border-radius: 9px; font-size: 14px; }

.br-selall-btn { margin-left: auto; padding: 8px 14px; border-radius: 9px; border: 1.5px solid var(--color-border, #e3e5e8); background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; color: #444; }
.br-selall-btn.on { border-color: var(--color-primary, #ee4d2d); color: var(--color-primary, #ee4d2d); background: #ee4d2d0a; }
.br-selcount { font-size: 13px; color: var(--color-primary, #ee4d2d); font-weight: 700; white-space: nowrap; }
.br-refresh { padding: 8px 12px; border-radius: 9px; border: 1.5px solid var(--color-border, #e3e5e8); background: #fff; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; color: #555; }
.br-refresh:disabled { opacity: .6; cursor: default; }
.br-shoptags { display: inline-flex; gap: 3px; flex: 0 0 auto; }
.br-shoptag { font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: #f1f2f4; color: #c2c8cf; cursor: help; }
.br-shoptag.on { background: #fef3c7; color: #b45309; }
.br-dupwarn { font-size: 12px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; padding: 8px 12px; border-radius: 9px; margin: 8px 0 0; }
.br-pvrow.dup { opacity: .5; }
.br-pvdup { font-size: 12px; font-weight: 700; color: #b45309; white-space: nowrap; }
.br-status.skip { background: #fef3c7; color: #b45309; }

.br-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; align-content: start; padding-bottom: 84px; }

/* 플로팅 캡슐 액션바 (Step1, 체크 시 등장) */
.br-capsule { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; background: #1e2330; color: #fff;
  padding: 9px 12px 9px 14px; border-radius: 999px;
  box-shadow: 0 14px 36px -10px rgba(0,0,0,.5), 0 3px 10px rgba(0,0,0,.22);
  animation: brCapUp .28s cubic-bezier(.2,.85,.25,1); }
@keyframes brCapUp { from { opacity: 0; transform: translate(-50%, 26px); } to { opacity: 1; transform: translate(-50%, 0); } }
.br-cap-thumbs { display: flex; align-items: center; }
.br-cap-thumbs img { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; border: 2px solid #1e2330; margin-left: -10px; background: #333; }
.br-cap-thumbs img:first-child { margin-left: 0; }
.br-cap-more { font-size: 12px; font-weight: 700; color: #cbd0d6; margin-left: 6px; }
.br-cap-count { font-size: 14px; font-weight: 800; white-space: nowrap; }
.br-cap-clear { width: 26px; height: 26px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.1); color: #b8bec7; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.br-cap-clear:hover { background: rgba(255,255,255,.22); color: #fff; }
.br-cap-next { border: none; cursor: pointer; background: var(--color-primary, #ee4d2d); color: #fff;
  padding: 9px 20px; border-radius: 999px; font-size: 14px; font-weight: 800; white-space: nowrap; }
.br-cap-next:hover { filter: brightness(1.06); }
.br-card { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px;
  border: 1.5px solid var(--color-border, #e8eaed); background: #fff; cursor: pointer; transition: border-color .12s, background .12s; }
.br-card:hover { border-color: #c7cace; }
.br-card.sel { border-color: var(--color-primary, #ee4d2d); background: #ee4d2d0a; }
.br-check { width: 17px; height: 17px; flex: 0 0 auto; cursor: pointer; }
.br-thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: #f0f1f3; flex: 0 0 auto; }
.br-thumb.sm { width: 34px; height: 34px; }
.br-info { flex: 1; min-width: 0; }
.br-line1 { display: flex; align-items: center; gap: 8px; }
.br-sku { font-weight: 800; font-size: 14px; }
.br-mbrand { font-size: 11px; font-weight: 700; color: var(--color-primary-hover, #4338ca); background: var(--color-primary-bg)/*≈#e0e7ff*/; padding: 2px 7px; border-radius: 6px; }
.br-name { font-size: 13px; color: var(--color-text-secondary, #555); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

.br-flags { display: flex; gap: 6px; flex: 0 0 auto; }
.br-flag { position: relative; font-size: 18px; opacity: .28; filter: grayscale(1); display: inline-flex; flex-direction: column; align-items: center; }
.br-flag.on { opacity: 1; filter: none; }
.br-dot { width: 6px; height: 6px; border-radius: 50%; background: #cbd0d6; margin-top: 1px; }
.br-dot.on { background: #10b981; box-shadow: 0 0 5px #10b98188; }

.br-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px;
  position: sticky; bottom: 0; z-index: 6; background: var(--color-bg, #fff);
  padding: 12px 0; border-top: 1px solid var(--color-border, #e8eaed); box-shadow: 0 -6px 14px -10px rgba(0,0,0,.18); }
.br-btn { padding: 11px 20px; border-radius: 10px; border: 1.5px solid var(--color-border, #e3e5e8); background: #fff;
  font-size: 14px; font-weight: 700; cursor: pointer; }
.br-btn.primary { background: var(--color-primary, #ee4d2d); border-color: var(--color-primary, #ee4d2d); color: #fff; }
.br-btn:disabled { opacity: .45; cursor: not-allowed; }

.br-empty { text-align: center; color: #98a0a8; padding: 50px 0; font-size: 14px; }

/* Step 2 */
.br-card2 { border: 1.5px solid var(--color-border, #e8eaed); border-radius: 13px; padding: 16px 18px; margin-bottom: 14px; background: #fff; }
.br-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid #f0f1f3; flex-wrap: wrap; }
.br-row:last-of-type { border-bottom: none; }
.br-row > b { width: 76px; flex: 0 0 auto; font-size: 13px; color: #555; }
.br-note { font-size: 12px; color: #6b7280; line-height: 1.7; margin: 10px 0 0; background: #f8f9fa; padding: 10px 12px; border-radius: 9px; }
.br-preview { display: flex; flex-direction: column; gap: 5px; max-height: 360px; overflow-y: auto; }
.br-pvrow { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 9px; background: #fafbfc; font-size: 13px; }
.br-pvrow .br-name { flex: 1; }
.br-pvflags { display: flex; gap: 4px; font-size: 15px; }

/* Step 3 — 진행 대시보드 */
.br-prog3 { display: flex; align-items: center; gap: 22px; padding: 18px 20px; margin-bottom: 16px;
  border: 1.5px solid var(--color-border, #e8eaed); border-radius: 14px; background: #fff; }
.br-donut { width: 108px; height: 108px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(var(--color-primary, #ee4d2d) calc(var(--pct) * 1%), #eceef0 0);
  display: flex; align-items: center; justify-content: center; transition: background .5s; }
.br-donut.run { animation: brPulse 1.6s ease-in-out infinite; }
@keyframes brPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(238,77,45,.30); } 50% { box-shadow: 0 0 0 9px rgba(238,77,45,0); } }
.br-donut-in { width: 84px; height: 84px; border-radius: 50%; background: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 22px; font-weight: 800; }
.br-donut-in span { font-size: 12px; color: #98a0a8; font-weight: 700; margin-top: 2px; }
.br-prog3-info { flex: 1; min-width: 0; }
.br-prog3-title { font-size: 18px; font-weight: 800; }
.br-arrow { color: var(--color-primary, #ee4d2d); margin: 0 4px; }
.br-prog3-sub { font-size: 13px; color: #888; margin-top: 3px; }
.br-prog3-stats { display: flex; gap: 14px; margin-top: 12px; font-size: 13px; font-weight: 700; flex-wrap: wrap; }
.br-prog3-stats .ok { color: #10b981; }
.br-prog3-stats .bad { color: #ef4444; }
.br-prog3-stats .skip { color: #b45309; }
.br-joblist { display: flex; flex-direction: column; gap: 6px; }
.br-jobrow { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px;
  border: 1.5px solid var(--color-border, #eef0f2); background: #fff; transition: border-color .2s, background .2s; }
.br-jobrow.st-running { border-color: #3b82f655; background: #3b82f608; }
.br-jobrow.st-done { border-color: #10b98144; }
.br-jobrow.st-failed { border-color: #ef444455; background: #ef444408; }
.br-jobrow.st-skipped { opacity: .6; }
.br-status { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 7px; flex: 0 0 auto; }
.br-status.wait { background: #f1f2f4; color: #888; }
.br-status.run { background: #3b82f622; color: #3b82f6; }
.br-status.ok { background: #10b98122; color: #10b981; }
.br-status.bad { background: #ef444422; color: #ef4444; }
.br-err { font-size: 11px; color: #ef4444; margin-top: 3px; white-space: normal; word-break: break-all; line-height: 1.4; }

@media (max-width: 980px) { .br-list { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .br-page { padding: 14px 12px 50px; }
  .br-stickyhead { margin: 0 -12px; padding: 10px 12px 8px; }
  .br-toolbar { flex-direction: column; align-items: stretch; }
  .br-name { max-width: 130px; }
  .br-flags { gap: 3px; }
  .br-flag { font-size: 15px; }
  .br-capsule { bottom: 80px; }  /* 모바일 하단탭 위로 */
}

/* ── 플랫폼 선택 바 (샵관리 disc-platform-bar 와 동일 룩) — 2026-07-08 momo/큐텐재팬 자리 ── */
.br-platform-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.br-platform-label { font-size: 11px; font-weight: 700; color: var(--color-text-secondary, #94a3b8); letter-spacing: 0.02em; }
.br-plat-btn { padding: 5px 12px; border-radius: 7px; border: 1px solid var(--color-border, #e2e8f0); background: var(--color-surface, #fff); font-size: 12px; font-weight: 600; color: var(--color-text-secondary, #64748b); cursor: pointer; }
.br-plat-btn.active { background: var(--color-primary, var(--color-primary-hover, #4338ca)); border-color: var(--color-primary, var(--color-primary-hover, #4338ca)); color: #fff; }
.br-plat-btn:disabled { opacity: .5; cursor: not-allowed; }
/* 리서치 페이지 — 양식 표준 준수. 색 = --pf 변수(인디고 하드코딩 금지). 카드 그리드(형 8/18). */

.rs-page { padding: 20px 24px; width: 100%; }
.rs-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

.rs-searchbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.rs-search { flex: 1; min-width: 200px; max-width: 520px; height: 40px; font-size: 14px; font-family: inherit; color: var(--color-text); }
.rs-search:focus { outline: none; }  /* 브라우저 기본 검정 outline 제거 — 전역 규칙의 브랜드 링만 (형 8/18) */
.rs-sort-select, .rs-calc-btn {
  height: 40px; border-radius: 10px; font-size: 14px; font-family: inherit; cursor: pointer; flex-shrink: 0;
  border: 1.5px solid var(--color-border-strong, #cbd5e1); background: #fff; color: var(--color-text);
}
.rs-sort-select { padding: 0 12px; }
.rs-sort-select:focus { border-color: var(--pf, var(--color-primary)); outline: none; }
.rs-calc-btn { display: inline-flex; align-items: center; gap: 5px; padding: 0 14px; font-weight: 600; color: var(--pf-deep, var(--color-primary)); border-color: var(--pf, var(--color-primary)); }
.rs-calc-btn:hover { background: var(--color-primary-bg, #f1f5f9); }
.rs-search-btn {
  height: 40px; padding: 0 22px; border: none; border-radius: 10px; cursor: pointer; flex-shrink: 0;
  background: var(--pf, var(--color-primary)); color: #fff; font-size: 14px; font-weight: 700; font-family: inherit;
}
.rs-search-btn:hover:not(:disabled) { background: var(--pf-deep, var(--color-primary)); }
.rs-search-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 확장 미설치 안내 */
.rs-ext-warn { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-bottom: 12px;
  background: #fff7ed; border: 1px solid #fdba74; border-radius: 12px; color: #9a3412; font-size: 13px; line-height: 1.6; }
.rs-ext-warn code { background: #fed7aa; padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.rs-ext-warn a { color: #c2410c; font-weight: 700; }
.rs-ext-steps { margin-top: 4px; color: #b45309; }
.rs-ext-recheck { margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid #fdba74; color: #9a3412; padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }

.rs-resultbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.rs-count { font-size: 13px; color: var(--color-text-secondary); font-weight: 600; }
.rs-count em { color: var(--pf, var(--color-primary)); font-style: normal; font-weight: 700; }
.rs-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-text); cursor: pointer; }
.rs-check input { accent-color: var(--pf, var(--color-primary)); width: 16px; height: 16px; }

.rs-err { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 10px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; color: #b91c1c; font-size: 13px; }
.rs-err-open { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; background: var(--pf, #ee4d2d); color: #fff; padding: 5px 12px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.rs-note { padding: 8px 14px; margin-bottom: 10px; background: var(--color-primary-bg, #f1f5f9); border: 1px solid var(--color-border-strong, #cbd5e1); border-radius: 10px; color: var(--color-text-secondary); font-size: 13px; }

/* ── 카드 그리드 — 한 줄 4~5개(화면폭 자동), 큰 썸네일 (형 8/18) ── */
.rs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 14px; }
.rs-card { background: var(--color-surface, #fff); border: 1px solid var(--color-border-strong, #cbd5e1); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .12s, border-color .12s; }
.rs-card:hover { border-color: var(--pf, var(--color-primary)); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.rs-card-imgwrap { position: relative; width: 100%; aspect-ratio: 1 / 1; background: #f1f5f9; }
.rs-card-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rs-card-noimg { width: 100%; height: 100%; background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 10px, #e8edf3 10px, #e8edf3 20px); }
.rs-card-rank { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.rs-card-kr { position: absolute; top: 6px; right: 6px; background: var(--pf, #ee4d2d); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.rs-card-body { padding: 12px 13px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rs-card-name { font-size: 14px; line-height: 1.4; color: var(--color-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; }
.rs-card-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-top: 2px; }
.rs-card-price { font-size: 16px; font-weight: 800; color: var(--color-text); white-space: nowrap; }
.rs-card-sold { font-size: 12px; font-weight: 700; color: var(--pf-deep, var(--color-primary)); white-space: nowrap; }
.rs-card-loc { font-size: 11.5px; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-open-btn { margin-top: auto; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 9px 10px; border-radius: 8px; background: var(--pf, var(--color-primary)); color: #fff; font-size: 13.5px; font-weight: 700; text-decoration: none; }
.rs-open-btn:hover { background: var(--pf-deep, var(--color-primary)); }

.rs-more { text-align: center; padding: 16px; }
.rs-more-btn { padding: 8px 20px; border: 1px solid var(--pf, var(--color-primary)); background: #fff; color: var(--pf-deep, var(--color-primary)); border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit; }
.rs-more-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.rs-empty { text-align: center; padding: 60px 20px; color: var(--color-text-secondary); font-size: 14px; }

/* ── 간이 마진 계산기 모달 ── */
.rs-modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.rs-modal { width: 360px; max-width: 92vw; max-height: 90vh; display: flex; flex-direction: column; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.rs-modal-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--pf, var(--color-primary)); color: #fff; }
.rs-modal-head span { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 15px; }
.rs-modal-country { background: rgba(255,255,255,.25); padding: 1px 8px; border-radius: 6px; font-size: 13px; }
.rs-modal-x { background: none; border: none; color: #fff; cursor: pointer; display: inline-flex; padding: 2px; }
.rs-modal-body { padding: 16px; overflow-y: auto; }
.rs-calc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.rs-calc-row span { font-size: 13px; color: var(--color-text-secondary); font-weight: 600; flex-shrink: 0; }
.rs-calc-row input { width: 150px; height: 36px; padding: 0 10px; border: 1.5px solid var(--color-border-strong, #cbd5e1); border-radius: 8px; font-size: 14px; text-align: right; font-family: inherit; }
.rs-calc-row input:focus { border-color: var(--pf, var(--color-primary)); outline: none; }
.rs-calc-rate { font-size: 12px; color: var(--color-text-secondary); margin: 4px 0 12px; }
.rs-calc-rate-note { color: #94a3b8; }
.rs-calc-result { background: var(--color-primary-bg, #f8fafc); border-radius: 10px; padding: 14px; text-align: center; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.rs-calc-loading, .rs-calc-hint { font-size: 13px; color: var(--color-text-secondary); }
.rs-calc-margin { font-size: 15px; color: var(--color-text); }
.rs-calc-margin b { font-size: 20px; }
.rs-calc-margin.neg b { color: #dc2626; }
.rs-calc-rate2 { font-size: 14px; color: var(--color-text-secondary); }
.rs-calc-rate2 b { color: var(--pf-deep, var(--color-primary)); font-size: 16px; }
.rs-calc-rate2.warn b { color: #dc2626; }
.rs-calc-foot { font-size: 11px; color: #94a3b8; margin-top: 12px; text-align: center; line-height: 1.5; }

/* ── 카테고리 쓸어오기 줄 (형 8/18) ── */
.rs-cat-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.rs-cat-label { font-size: 13px; font-weight: 700; color: var(--pf-deep, var(--color-primary)); white-space: nowrap; }
.rs-cat-select { height: 40px; padding: 0 12px; border: 1.5px solid var(--pf, var(--color-border-strong)); border-radius: 10px; background: #fff; font-size: 14px; font-family: inherit; color: var(--color-text); cursor: pointer; flex-shrink: 0; max-width: 150px; }
.rs-cat-select:focus { outline: none; box-shadow: var(--pf-ring); }

/* ── 카드 월판매/매출 표시 ── */
.rs-card-stats { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--color-text-secondary); }
.rs-stat-month b { color: var(--pf-deep, var(--color-primary)); font-size: 16px; }
.rs-stat-total { font-size: 11px; color: #94a3b8; }
.rs-card-rev { font-size: 13px; color: var(--color-text-secondary); }
.rs-card-rev b { color: #16a34a; font-weight: 800; font-size: 15px; }
.rs-count em { color: var(--pf-deep, var(--color-primary)); font-style: normal; font-weight: 800; }

/* ── 카드 = 한 줄 5개 고정(형 8/18 "6개 말고 5개 크게") — 화면 넓어도 5개 넘지 않음, 좁으면 4→3→2 ── */
.rs-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1400px) { .rs-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .rs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px)  { .rs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* 글자 키움 */
.rs-card-name { font-size: 15.5px; min-height: 44px; }
.rs-card-price { font-size: 18px; }
.rs-card-stats { font-size: 14px; }
.rs-stat-month b { font-size: 18px; }
.rs-stat-total { font-size: 12px; }
.rs-card-rev { font-size: 14px; }
.rs-card-rev b { font-size: 16.5px; }
.rs-card-loc { font-size: 12.5px; }
.rs-open-btn { font-size: 14.5px; padding: 10px 10px; }
.rs-card-rank, .rs-card-kr { font-size: 12px; padding: 2px 8px; }

/* ── v3.1 (형 8/18 밤): 카드 2줄 압축·라벨 명확·버튼 2개·경로 표시·체크박스 검색줄 이동 ── */
.rs-searchbar .rs-check { margin-left: 4px; white-space: nowrap; font-size: 14px; }
.rs-cat-select:disabled { color: var(--color-text-secondary); cursor: default; }
.rs-via { font-size: 12px; color: #94a3b8; margin-bottom: 8px; }
.rs-card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rs-card-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.rs-card-row .rs-card-price { font-size: 17px; }
.rs-card-row .rs-stat-month { font-size: 13px; color: var(--color-text-secondary); white-space: nowrap; }
.rs-card-row .rs-stat-month b { font-size: 16px; color: var(--pf-deep, var(--color-primary)); }
.rs-card-row .rs-card-rev { font-size: 13px; color: var(--color-text-secondary); white-space: nowrap; }
.rs-card-row .rs-card-rev b { font-size: 16px; }
.rs-card-row .rs-card-loc { font-size: 12.5px; text-align: right; flex: 1; min-width: 0; }
.rs-card-body > .rs-stat-total { font-size: 12px; color: #94a3b8; margin-top: -2px; }
.rs-card-btns { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding-top: 4px; }
.rs-card-btns .rs-open-btn { margin-top: 0; padding: 9px 4px; font-size: 13.5px; }
.rs-shop-btn { background: #fff !important; color: var(--pf-deep, var(--color-primary)) !important; border: 1.5px solid var(--pf, var(--color-primary)); }
.rs-shop-btn:hover { background: var(--pf-hover, #fff5f2) !important; }

/* ── v3.2 (형 카드 모양 확정): 판매금액 / 월판매량-n개 ─ 월매출 / 누적 ─ 국가·도시(작게). 카테고리 칸 160px 고정 ── */
.rs-cat-select { width: 160px; max-width: 160px; min-width: 160px; text-overflow: ellipsis; }
.rs-card-body > .rs-card-price { font-size: 18px; font-weight: 800; }
.rs-card-row .rs-stat-month { font-size: 13.5px; }
.rs-card-row .rs-stat-month b { font-size: 16px; }
.rs-card-row .rs-card-rev b { font-size: 16px; }
.rs-card-row .rs-stat-total { font-size: 12.5px; color: var(--color-text-secondary); white-space: nowrap; }
.rs-card-row .rs-card-loc { font-size: 11.5px; color: #94a3b8; }
.rs-stop-btn { background: #fff !important; color: var(--pf-deep, var(--color-primary)) !important; border: 1.5px solid var(--pf, var(--color-primary)); }

/* ── v5.0: 자동 훑기 상태줄 · 집계 탭(뜨는 상품/브랜드 순위/우리 없는 것) ── */
.rs-crawlbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin: -4px 0 12px; font-size: 12.5px; color: var(--color-text-secondary); text-align: right; }
.rs-crawl-toggle { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 15px; border-radius: 11px; border: 1.5px solid var(--color-border-strong, #cbd5e1); background: #fff; color: var(--color-text-secondary); font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit; flex-shrink: 0; }
.rs-crawl-toggle.on { border-color: var(--pf, var(--color-primary)); color: var(--pf-deep, var(--color-primary)); background: var(--pf-bg, #fff5f2); }
.rs-crawl-warn { color: #b91c1c; font-weight: 700; }
.rs-viewhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; }
.rs-viewdesc { color: var(--color-text-secondary); font-size: 12.5px; margin-left: 6px; }
.rs-viewhead-r { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; color: var(--color-text-secondary); font-size: 13px; }
.rs-viewhead-r .rs-ext-recheck { margin-top: 0; border-color: var(--color-border-strong, #cbd5e1); color: var(--color-text-secondary); }
.rs-delta { color: var(--color-text-secondary); display: inline-flex; align-items: center; gap: 3px; }
.rs-delta.up { color: #16a34a; font-weight: 700; }
.rs-new { color: var(--pf-deep, var(--color-primary)); font-weight: 700; }
.rs-tablewrap { overflow-x: auto; }
.rs-table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--color-surface, #fff); }
.rs-table th, .rs-table td { padding: 9px 10px; border-bottom: 1px solid var(--color-border, #e5e7eb); text-align: left; white-space: nowrap; }
.rs-table th { background: var(--pf-bg, #f8fafc); color: var(--color-text-secondary); font-weight: 700; font-size: 12.5px; }
.rs-table tbody tr:hover { background: var(--pf-hover, #fff5f2); }
.rs-td-name { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.rs-td-name a { color: var(--color-text); text-decoration: none; }
.rs-td-name a:hover { color: var(--pf-deep, var(--color-primary)); text-decoration: underline; }
.rs-ours { color: #16a34a; font-weight: 700; }
.rs-notours { color: #b91c1c; font-weight: 700; }
.rs-muted { color: #94a3b8; font-size: 12px; }
.rs-minprice { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--color-text-secondary); white-space: nowrap; }
.rs-minprice input { width: 64px; height: 32px; padding: 0 6px; border: 1.5px solid var(--color-border-strong, #cbd5e1); border-radius: 8px; font-size: 13px; text-align: right; font-family: inherit; }
.rs-kbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.rs-kchips { display: flex; gap: 6px; flex-wrap: wrap; }
.rs-kdesc { margin: 0 0 10px; }

/* ── 셀러 순위 (형 8/20 — krtop 방식) ── */
.rs-adv-toggle { height: 40px; padding: 0 14px; border: 1.5px solid var(--color-border-strong, #cbd5e1); background: #fff; color: var(--color-text-secondary); border-radius: 10px; font-size: 13px; font-family: inherit; cursor: pointer; flex-shrink: 0; }
.rs-adv-toggle.on, .rs-adv-toggle:hover { border-color: var(--pf, var(--color-primary)); color: var(--pf-deep, var(--color-primary)); }
.rs-seller-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.rs-seller-card { background: var(--color-surface, #fff); border: 1px solid var(--color-border-strong, #cbd5e1); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 12px; transition: box-shadow .12s, border-color .12s; }
.rs-seller-card:hover { border-color: var(--pf, var(--color-primary)); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.rs-seller-head { display: flex; align-items: center; gap: 9px; }
.rs-seller-rank { flex-shrink: 0; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; background: var(--pf, #ee4d2d); color: #fff; font-size: 13px; font-weight: 800; border-radius: 8px; }
.rs-seller-name { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 700; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-seller-head .rs-shop-btn { margin: 0; flex-shrink: 0; padding: 6px 10px; font-size: 12.5px; }
.rs-seller-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rs-seller-stat { display: flex; flex-direction: column; gap: 3px; padding: 8px 6px; background: var(--color-primary-bg, #f8fafc); border-radius: 9px; text-align: center; }
.rs-seller-stat span { font-size: 11px; color: var(--color-text-secondary); }
.rs-seller-stat b { font-size: 14px; font-weight: 800; color: var(--color-text); }
.rs-seller-stat:first-child b { color: var(--pf-deep, var(--color-primary)); }
.rs-seller-top { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--color-border, #e2e8f0); border-radius: 10px; text-decoration: none; }
.rs-seller-top:hover { border-color: var(--pf, var(--color-primary)); }
.rs-seller-top-img, .rs-seller-top .rs-card-noimg { width: 48px; height: 48px; flex-shrink: 0; border-radius: 8px; object-fit: cover; }
.rs-seller-top-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rs-seller-top-label { font-size: 10.5px; font-weight: 700; color: var(--pf, #ee4d2d); }
.rs-seller-top-name { font-size: 12.5px; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-seller-top-sold { font-size: 11.5px; font-weight: 700; color: var(--color-text-secondary); }
.rs-seller-loc { font-size: 11.5px; color: var(--color-text-secondary); }

/* ── 씨앗·진단 (형 8/20 재작성) ── */
.rs-seedwrap { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.rs-seedbox { background: var(--color-surface, #fff); border: 1px solid var(--color-border-strong, #cbd5e1); border-radius: 12px; padding: 16px 18px; }
.rs-seedbox-title { font-size: 15px; font-weight: 800; color: var(--color-text); margin-bottom: 6px; }
.rs-seedbox-desc { font-size: 12.5px; color: var(--color-text-secondary); line-height: 1.6; margin-bottom: 12px; }
.rs-seedbox-desc code { background: var(--color-primary-bg, #f1f5f9); padding: 1px 6px; border-radius: 4px; }
.rs-seedadd { display: flex; gap: 8px; margin-bottom: 12px; }
.rs-seedadd .rs-search { flex: 1; min-width: 0; height: 40px; border: 1.5px solid var(--color-border-strong, #cbd5e1); border-radius: 10px; padding: 0 12px; font-family: inherit; }
.rs-seedadd .rs-search:focus { border-color: var(--pf, var(--color-primary)); outline: none; }
.rs-seed-empty { font-size: 13px; color: var(--color-text-secondary); }
.rs-seedlist { display: flex; flex-wrap: wrap; gap: 8px; }
.rs-seed-item { display: inline-flex; align-items: center; gap: 6px; background: var(--color-primary-bg, #f8fafc); border: 1px solid var(--color-border, #e2e8f0); border-radius: 8px; padding: 5px 6px 5px 11px; }
.rs-seed-item a { font-size: 13px; font-weight: 700; color: var(--pf-deep, var(--color-primary)); text-decoration: none; }
.rs-seed-del { background: none; border: none; cursor: pointer; color: var(--color-text-secondary); display: inline-flex; padding: 2px; border-radius: 5px; }
.rs-seed-del:hover { color: #b91c1c; background: #fef2f2; }
.rs-diag { margin-top: 4px; padding: 11px 13px; border-radius: 10px; font-size: 13px; line-height: 1.6; }
.rs-diag.ok { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.rs-diag.bad { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.rs-diag-s { display: inline-block; margin-left: 6px; padding: 1px 7px; background: rgba(0,0,0,.05); border-radius: 6px; font-size: 12px; }
.rs-diag-hint { margin-top: 6px; font-size: 12px; font-weight: 700; }
.rs-delta { font-size: 12px; font-weight: 700; color: var(--color-text-secondary); display: inline-flex; align-items: center; gap: 3px; }
.rs-delta.up { color: #16a34a; }
.rs-new { font-size: 12px; font-weight: 700; color: var(--pf-deep, var(--color-primary)); }
.rs-stat-month { font-size: 12.5px; color: var(--color-text-secondary); }
.rs-stat-month b { color: var(--pf-deep, var(--color-primary)); }

/* ═══════ 현대적 카드 디자인 (형 8/20 "구닥다리" → 리디자인) ═══════ */
.rs-ext-update { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.rs-ext-update code { background: #dbeafe; }
.rs-ext-update .rs-ext-recheck { border-color: #bfdbfe; color: #1e40af; }

/* 셀러 카드 — 상품 이미지 앞세운 큰 카드 */
.rs-seller-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.rs-seller-card { border: 1px solid var(--color-border, #e8edf3); border-radius: 16px; padding: 16px; gap: 14px; box-shadow: 0 1px 2px rgba(15,23,42,.04); transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.rs-seller-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(15,23,42,.12); border-color: var(--pf, var(--color-primary)); }
.rs-seller-head { gap: 10px; }
.rs-seller-rank { width: 30px; height: 30px; border-radius: 10px; font-size: 14px; box-shadow: 0 2px 6px color-mix(in srgb, var(--pf, #ee4d2d) 40%, transparent); }
.rs-seller-name { font-size: 15.5px; font-weight: 800; letter-spacing: -.2px; }
.rs-seller-head .rs-shop-btn { border-radius: 9px; padding: 7px 12px; box-shadow: none; }
/* 매출 = 히어로 */
.rs-seller-stats { grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; background: linear-gradient(180deg, color-mix(in srgb, var(--pf,#ee4d2d) 6%, #fff), #fff); border: 1px solid var(--color-border, #eef2f7); border-radius: 13px; padding: 10px; }
.rs-seller-stat { background: none; padding: 4px 2px; }
.rs-seller-stat span { font-size: 11px; letter-spacing: -.2px; }
.rs-seller-stat b { font-size: 15px; letter-spacing: -.3px; }
.rs-seller-stat:first-child b { font-size: 18px; font-weight: 900; }
/* 1등 상품 = 썸네일 크게 */
.rs-seller-top { gap: 12px; padding: 10px; border-radius: 13px; border-color: var(--color-border, #eef2f7); background: #fff; }
.rs-seller-top:hover { box-shadow: 0 3px 10px rgba(15,23,42,.08); }
.rs-seller-top-img, .rs-seller-top .rs-card-noimg { width: 58px; height: 58px; border-radius: 11px; }
.rs-seller-top-label { font-size: 10px; letter-spacing: .3px; text-transform: uppercase; }
.rs-seller-top-name { font-size: 13px; font-weight: 600; }
.rs-seller-loc { font-size: 11.5px; color: var(--color-text-secondary); padding-left: 2px; }

/* 상품 카드 — 이미지 크게, 깔끔 */
.rs-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.rs-card { border: 1px solid var(--color-border, #e8edf3); border-radius: 16px; box-shadow: 0 1px 2px rgba(15,23,42,.04); transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.rs-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(15,23,42,.12); border-color: var(--pf, var(--color-primary)); }
.rs-card-rank { top: 8px; left: 8px; background: color-mix(in srgb, #0f172a 62%, transparent); backdrop-filter: blur(2px); padding: 2px 9px; border-radius: 20px; font-size: 11px; }
.rs-card-body { padding: 13px 14px 14px; gap: 7px; }
.rs-card-name { font-size: 13.5px; font-weight: 600; min-height: 38px; }
.rs-card-price { font-size: 17px; font-weight: 900; letter-spacing: -.4px; }
.rs-card-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rs-card-btns { display: flex; gap: 7px; margin-top: 4px; }
.rs-card-btns .rs-open-btn { flex: 1; margin: 0; padding: 9px 8px; border-radius: 10px; font-size: 12.5px; }
.rs-shop-btn { background: #fff !important; color: var(--pf-deep, var(--color-primary)) !important; border: 1.5px solid var(--pf, var(--color-primary)); }
.rs-shop-btn:hover { background: var(--color-primary-bg, #f1f5f9) !important; }

/* 국가 버튼 (국기 + 한글, 샵관리 느낌) */
.rs-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.rs-country-btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 15px; border: 1.5px solid var(--color-border-strong, #cbd5e1); background: #fff; color: var(--color-text); border-radius: 11px; font-size: 13.5px; font-weight: 700; font-family: inherit; cursor: pointer; transition: border-color .12s, box-shadow .12s, color .12s; }
.rs-country-btn:hover:not(.active) { border-color: var(--pf, var(--color-primary)); }
.rs-country-btn.active { border-color: var(--pf, var(--color-primary)); color: var(--pf-deep, var(--color-primary)); box-shadow: 0 0 0 3px var(--pf-ring, color-mix(in srgb, var(--pf, #ee4d2d) 18%, transparent)); }
.rs-viewdesc { font-size: 12.5px; color: var(--color-text-secondary); margin: -2px 0 12px; padding-left: 2px; }

/* 고급(직접추가·진단) 접이 — 맨 아래 작게 */
.rs-adv-foot { margin-top: 28px; padding-top: 14px; border-top: 1px dashed var(--color-border, #e2e8f0); }
.rs-adv-link { background: none; border: none; color: var(--color-text-secondary); font-size: 12px; cursor: pointer; font-family: inherit; padding: 4px 2px; }
.rs-adv-link:hover { color: var(--pf-deep, var(--color-primary)); }
.rs-adv-foot .rs-seedwrap { margin-top: 12px; }

/* 수집할 나라 켜기/끄기 칩 (형 8/21) */
.rs-crawl-countries { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -4px 0 14px; padding: 10px 12px; background: var(--color-primary-bg, #f8fafc); border: 1px solid var(--color-border, #e8edf3); border-radius: 12px; }
.rs-cc-label { font-size: 12.5px; font-weight: 700; color: var(--color-text-secondary); }
.rs-cc-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1.5px solid var(--color-border-strong, #cbd5e1); background: #fff; color: var(--color-text-secondary); border-radius: 9px; font-size: 12.5px; font-weight: 700; font-family: inherit; cursor: pointer; opacity: .65; }
.rs-cc-chip.on { border-color: var(--pf, var(--color-primary)); color: var(--pf-deep, var(--color-primary)); opacity: 1; box-shadow: 0 0 0 2px var(--pf-ring, color-mix(in srgb, var(--pf, #ee4d2d) 15%, transparent)); }
.rs-cc-hint { font-size: 11.5px; color: var(--color-text-secondary); margin-left: 4px; }

/* ── 셀러 순위 = 리스트(행) 형식 (형 8/21) ── */
.rs-seller-list { display: flex; flex-direction: column; border: 1px solid var(--color-border, #e8edf3); border-radius: 14px; overflow: hidden; background: var(--color-surface, #fff); }
.rs-sl-head, .rs-sl-row { display: grid; grid-template-columns: 46px minmax(220px, 360px) 130px 78px 86px minmax(180px, 1fr) 64px; align-items: center; gap: 10px; padding: 10px 14px; }
.rs-sl-head { background: var(--color-primary-bg, #f8fafc); border-bottom: 1px solid var(--color-border, #e8edf3); font-size: 12px; font-weight: 700; color: var(--color-text-secondary); position: sticky; top: 0; z-index: 1; }
.rs-sl-row { border-bottom: 1px solid var(--color-border, #eef2f7); transition: background .1s; }
.rs-sl-row:hover { background: var(--pf-hover, color-mix(in srgb, var(--pf, #ee4d2d) 6%, #fff)); }
.rs-sl-row:last-child { border-bottom: none; }
.rs-sl-rank { font-size: 14px; font-weight: 800; color: var(--pf-deep, var(--color-primary)); text-align: center; }
.rs-sl-shop { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rs-sl-img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.rs-sl-shopinfo { display: flex; flex-direction: column; min-width: 0; }
.rs-sl-name { font-size: 14px; font-weight: 700; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-sl-loc { font-size: 11px; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-sl-num { font-size: 13.5px; font-weight: 700; color: var(--color-text); text-align: right; white-space: nowrap; }
.rs-sl-rev { color: var(--pf-deep, var(--color-primary)); font-weight: 800; }
.rs-sl-top { display: flex; align-items: center; gap: 8px; min-width: 0; text-decoration: none; padding-left: 16px; border-left: 1px solid #b6bfcc; }
.rs-sl-topimg { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.rs-sl-topinfo { display: flex; flex-direction: column; min-width: 0; }
.rs-sl-topname { font-size: 12px; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-sl-toplink:hover .rs-sl-topname { color: var(--pf-deep, var(--color-primary)); }
.rs-sl-topsold { font-size: 11px; font-weight: 700; color: var(--color-text-secondary); }
.rs-sl-muted { color: var(--color-text-secondary); }
.rs-sl-act.rs-shop-btn { padding: 6px 8px; font-size: 12px; margin: 0; justify-content: center; }
@media (max-width: 720px) { .rs-sl-head { display: none; } .rs-sl-row { grid-template-columns: 32px 1fr auto; grid-template-areas: 'r shop act' 'r nums nums' 'r top top'; row-gap: 6px; } .rs-sl-rank { grid-area: r; } .rs-sl-shop { grid-area: shop; } .rs-sl-act { grid-area: act; } .rs-sl-num { grid-area: nums; text-align: left; display: inline; } .rs-sl-top { grid-area: top; } }

/* ── 설정 모달 ── */
.rs-modal-wide { width: 620px; max-width: 94vw; }
.rs-set-sec { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--color-border, #eef2f7); }
.rs-set-title { font-size: 15px; font-weight: 800; color: var(--color-text); margin-bottom: 4px; }
.rs-set-desc { font-size: 12.5px; color: var(--color-text-secondary); margin-bottom: 10px; }
.rs-set-countries { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── 셀러 리스트 = 예쁜 가로 카드 (형 8/21: 카드 느낌 살려서 일자로 + 열 맞춤 + 호버) ── */
.rs-seller-list { border: none; border-radius: 0; overflow: visible; background: none; gap: 10px; }
.rs-sl-head { background: none; border: none; position: static; padding: 2px 18px; color: var(--color-text-secondary); }
.rs-sl-row { border: 1px solid var(--color-border, #e8edf3); border-radius: 14px; padding: 13px 18px; background: var(--color-surface, #fff); box-shadow: 0 1px 2px rgba(15,23,42,.05); transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.rs-sl-row:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(15,23,42,.13); border-color: var(--pf, var(--color-primary)); }
.rs-sl-img { width: 56px; height: 56px; border-radius: 13px; }
.rs-sl-topimg { width: 40px; height: 40px; border-radius: 9px; }
.rs-sl-name { font-size: 14.5px; }
.rs-sl-rev { font-size: 15px; }

/* ── 셀러 리스트 촘촘하게 (형 8/21 "공간활용·행 높이") ── */
.rs-seller-list { gap: 7px; }
.rs-sl-head, .rs-sl-row { grid-template-columns: 44px minmax(220px, 360px) 130px 78px 86px minmax(180px, 1fr) 64px; gap: 16px; }
.rs-sl-row { padding: 8px 16px; }
.rs-sl-img { width: 38px; height: 38px; border-radius: 10px; }
.rs-sl-topimg { width: 34px; height: 34px; }
.rs-sl-name { font-size: 13.5px; }
.rs-sl-loc { font-size: 10.5px; }
.rs-sl-num { font-size: 13px; }
.rs-sl-rev { font-size: 14px; }
.rs-sl-act.rs-shop-btn { padding: 5px 8px; font-size: 11.5px; }

/* ── 셀러 행 위아래 넓게 (형 8/21 "좀 넓혀줘") ── */
.rs-sl-row { padding: 16px 18px; }
.rs-sl-img { width: 56px; height: 56px; border-radius: 13px; }
.rs-sl-topimg { width: 42px; height: 42px; border-radius: 10px; }
.rs-sl-name { font-size: 14.5px; }
.rs-sl-loc { font-size: 11px; }
.rs-sl-num { font-size: 13.5px; }
.rs-sl-rev { font-size: 15px; }
.rs-seller-list { gap: 9px; }
.rs-sl-pending { text-align: center; padding: 14px; margin-top: 6px; color: var(--color-text-secondary); font-size: 12.5px; border: 1px dashed var(--color-border, #e2e8f0); border-radius: 12px; }
.rs-diag-detail { margin-top: 6px; font-family: monospace; font-size: 11px; background: rgba(0,0,0,.05); padding: 8px; border-radius: 6px; word-break: break-all; white-space: pre-wrap; max-height: 140px; overflow-y: auto; }

.rs-view-title { font-size: 15px; font-weight: 800; color: var(--pf-deep, var(--color-primary)); }
.rs-sl-badge { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 5px; font-size: 10.5px; font-weight: 800; vertical-align: middle; }
.rs-sl-badge.mall { background: #fee2e2; color: #b91c1c; }
.rs-sl-badge.pref { background: #fef3c7; color: #b45309; }

.rs-typebar { display: flex; align-items: center; gap: 6px; padding-top: 9px; margin: -4px 0 12px; border-top: 1px solid var(--color-border-strong, #cbd5e1); }
.rs-type-label { font-size: 11.5px; font-weight: 700; color: var(--color-text-secondary); margin-right: 4px; }
.rs-type-chip { height: 28px; padding: 0 13px; border: 1.5px solid var(--color-border-strong, #cbd5e1); background: #fff; color: var(--color-text-secondary); border-radius: 8px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; }
.rs-type-chip.on { border-color: var(--pf, var(--color-primary)); color: var(--pf-deep, var(--color-primary)); background: var(--pf-bg, #fff5f2); }
.rs-type-chip:hover:not(.on) { border-color: var(--pf, var(--color-primary)); }

.rs-sl-div { border-left: 1px solid #b6bfcc; padding-left: 16px; }
.rs-last-crawl { font-size: 12px; color: var(--color-text-secondary); margin-left: 6px; white-space: nowrap; align-self: center; }
.rs-crawl-inline { margin-left: auto; text-align: right; font-size: 12px; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.rs-sl-topname { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; }

/* 샵 등급 칩 = 크게 + 켜짐 뚜렷 + 꺼짐 회색+빗금 */
.rs-type-chip { height: 32px; padding: 0 16px; border: 1.5px solid #cbd5e1; background: #fff; color: #8a94a6; border-radius: 9px; font-size: 13px; font-weight: 800; transition: box-shadow .12s, border-color .12s, color .12s; }
.rs-type-chip:not(.on) { color: #9aa4b2; border-color: #cbd5e1; background-image: repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(148,163,184,.28) 5px, rgba(148,163,184,.28) 6px); }
.rs-type-chip.on { border: 2px solid var(--pf, #ee4d2d); color: var(--pf-deep, #d63a1a); background: #fff; background-image: none; box-shadow: 0 0 0 3px var(--pf-ring, rgba(238,77,45,.16)); }
.rs-type-chip:hover:not(.on) { border-color: var(--pf, #ee4d2d); color: var(--pf-deep, #d63a1a); background-image: none; box-shadow: 0 0 0 3px rgba(238,77,45,.1); }
.rs-type-chip.on:hover { box-shadow: 0 0 0 4px var(--pf-ring, rgba(238,77,45,.24)); }

/* ── 카드 스타일 유지 + 구분선·호버·헤더만 손질 (형 8/25) ── */
.rs-sl-row:hover { background: var(--color-surface, #fff); }   /* 호버 = 배경 채움 제거, 테두리·그림자만 */
.rs-sl-head { background: var(--color-primary-bg, #f3f5f9); border: 1px solid var(--color-border, #e8edf3); border-radius: 10px; padding: 9px 18px; font-weight: 800; color: var(--color-text-secondary); }   /* 헤더 명확히 */
.rs-sl-div, .rs-sl-top { align-self: stretch; display: flex; align-items: center; }   /* 세로 구분선 = 카드 높이만큼 */
.rs-sl-div { justify-content: flex-end; }
.rs-sl-topname { font-size: 13px; color: var(--color-text); font-weight: 600; }   /* 1등상품 이름 크게+진하게 */
.rs-sl-topsold { font-size: 12px; font-weight: 800; color: var(--pf-deep, #d63a1a); }   /* 월N 주황 */
.rs-sl-topimg { width: 46px; height: 46px; border-radius: 10px; }
.rs-sl-act.rs-shop-btn { padding: 9px 14px; font-size: 12.5px; }   /* 샵 버튼 크게 */

/* 헤더 진하게 = 쇼피 브랜드 톤 (형 8/25 "쇼피 탭인데 왜 회색이야" — 회색 사고 정정. 변수 기반, momo 오면 자동 핑크) */
.rs-sl-head {
  background: #fde3dd; background: color-mix(in srgb, var(--pf, #ee4d2d) 16%, #fff);   /* 앞줄 = 구형 브라우저 대비 같은 색 고정값 */
  color: var(--pf-deep, #c93a1c);
  border-color: #f9c3b8; border-color: color-mix(in srgb, var(--pf, #ee4d2d) 34%, #fff);
}
.rs-type-chip:hover:not(.on) { border-color: #94a3b8; color: #5b6676; box-shadow: none; background-image: repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(120,132,150,.35) 5px, rgba(120,132,150,.35) 6px); }

/* ── 8/25 손질: ② 월판매↔1등상품 간격 벌림 · ④ 수집설정 모달 안내 톤 ── */
.rs-sl-head > :nth-child(5), .rs-sl-row > :nth-child(5) { padding-right: 12px; }   /* 월판매 숫자 ↔ 구분선 */
.rs-sl-top { padding-left: 28px; }                                                  /* 구분선 ↔ 1등상품 썸네일 */
.rs-set-sec .rs-ext-recheck { border-color: var(--color-border-strong, #cbd5e1); color: var(--color-text-secondary); }
.rs-set-sec code { background: var(--color-primary-bg, #f1f5f9); padding: 1px 6px; border-radius: 4px; }
.rs-set-sec a { color: var(--pf-deep, var(--color-primary)); font-weight: 700; }

/* ── 셀러순위 헤더 글자 통일 (형 8/25 "우후죽순") — 크기·굵기만 통일. 🛑색은 건드리지 않음(형 지시): 숫자열=검정, 셀러·1등상품·#=원래 색 ── */
.rs-sl-head > * { font-size: 12.5px; font-weight: 800; }

/* ── 카테고리 대>중>소 자체 드롭다운 (형 8/25 — 기본 select 폐기) ── */
.rs-drop { position: relative; }
.rs-drop-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 11px 0 14px; border: 1.5px solid var(--color-border-strong, #cbd5e1); background: #fff; border-radius: 10px; font-size: 13.5px; font-weight: 700; font-family: inherit; color: var(--color-text-secondary); cursor: pointer; }
.rs-drop-btn:hover:not(:disabled) { border-color: var(--pf, var(--color-primary)); }
.rs-drop-btn.picked { border-color: var(--pf, var(--color-primary)); color: var(--color-text); box-shadow: 0 0 0 3px var(--pf-ring, rgba(238,77,45,.16)); }   /* 선택 = 검색창 포커스 문법 */
.rs-drop-btn:disabled { opacity: .45; cursor: default; }
.rs-drop-lab { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-drop-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 80; min-width: 210px; max-height: 340px; overflow-y: auto; background: #fff; border: 1px solid var(--color-border, #e5e7eb); border-radius: 12px; box-shadow: 0 12px 30px rgba(15,23,42,.16); padding: 6px; }
.rs-drop-item { display: block; width: 100%; text-align: left; padding: 8px 12px; border: none; background: none; border-radius: 8px; font-size: 13.5px; color: var(--color-text); cursor: pointer; font-family: inherit; white-space: nowrap; }
.rs-drop-item:hover { background: var(--pf-hover, #fdeae4); }
.rs-drop-item.sel { color: var(--pf-deep, #c93a1c); font-weight: 800; }
.rs-catprog { font-size: 12px; color: var(--color-text-secondary); white-space: nowrap; }   /* 카테고리 채움 진행(채우는 중일 때만) */

/* ── [설정] 탭 — 가로 2단 (형 8/25) ── */
.rs-set-grid { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr); gap: 16px; align-items: start; }
.rs-set-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rs-set-col .rs-set-sec, .rs-set-col .rs-seedbox { border: 1px solid var(--color-border, #e5e7eb); border-radius: 12px; padding: 14px 16px; background: #fff; margin: 0; }
.rs-set-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.rs-set-status { line-height: 1.6; }
@media (max-width: 900px) { .rs-set-grid { grid-template-columns: 1fr; } }

/* ── 8/26 묶음: 설정 재정리·검색·배지·1000+·카드 6줄·색 ── */
.rs-set { display: flex; flex-direction: column; gap: 12px; }
.rs-set .rs-set-sec { border: 1px solid var(--color-border, #e5e7eb); border-radius: 12px; padding: 14px 16px; background: #fff; margin: 0; }
.rs-set-sub { font-weight: 500; color: var(--color-text-secondary); font-size: 12.5px; }
.rs-set-sep { width: 1px; height: 22px; background: var(--color-border, #e5e7eb); margin: 0 6px; }
.rs-mode-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--color-border-strong, #cbd5e1); background: #fff; color: var(--color-text); font-size: 13.5px; font-weight: 700; font-family: inherit; cursor: pointer; }
.rs-mode-btn.on { border-color: var(--pf, var(--color-primary)); box-shadow: 0 0 0 3px var(--pf-ring, rgba(238,77,45,.16)); }
.rs-mode-btn:hover:not(.on) { border-color: var(--pf, var(--color-primary)); }
.rs-ext-badge { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; font-weight: 700; background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.rs-ext-badge.ok { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.rs-excl-chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 6px 2px 0; padding: 2px 8px; border-radius: 8px; background: var(--color-primary-bg, #f1f5f9); font-size: 12.5px; }
.rs-seedwrap2 .rs-seedadd { margin-top: 4px; }
.rs-seedwrap2 .rs-seedlist { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rs-search-sm { height: 36px; max-width: 280px; min-width: 180px; font-size: 13.5px; }
.rs-last-crawl-dark { color: var(--color-text) !important; font-weight: 600; }
.rs-sl-badge.manual { background: var(--color-primary-bg, #eef2ff); color: var(--pf-deep, var(--color-primary)); }
.rs-sl-actwrap { display: inline-flex; align-items: center; gap: 6px; }
.rs-card-kr.local { background: #64748b; }
.rs-card-loc { color: var(--color-text); font-weight: 600; }   /* 셀러 샵 이름 검정 (형 8/26) */
.rs-grid { grid-template-columns: repeat(auto-fill, minmax(276px, 1fr)); gap: 16px; }   /* 카드 크게 = 한 줄 6개 (형 8/26) */
.rs-card-body { gap: 8px; padding: 14px 15px; }
.rs-card-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rs-card .rs-card-body .rs-card-loc { color: var(--color-text); font-weight: 600; }   /* 우선순위 올려 확실히 검정 */
/* 카드 = 한 줄 딱 6개 고정 (형 8/26). 좁은 화면만 줄어듦 */
.rs-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1500px) { .rs-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 1250px) { .rs-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .rs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .rs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* 파도타기/최신화 켜짐·꺼짐 확실하게 (형 8/26): 켜짐=브랜드 테두리+링+연브랜드 배경+초록 점 / 꺼짐=회색·흐리게 */
.rs-mode-btn { color: var(--color-text-secondary); border-color: var(--color-border-strong, #cbd5e1); background: #f8fafc; }
.rs-mode-btn b { font-weight: 800; }
.rs-mode-btn.on { color: var(--pf-deep, #c93a1c); background: var(--pf-bg, #fdf3ef); border-color: var(--pf, #ee4d2d); box-shadow: 0 0 0 3px var(--pf-ring, rgba(238,77,45,.18)); }
.rs-dot { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; display: inline-block; }
.rs-dot.on { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
/* 8/26 묶음3: 등록 버튼 정렬 · 배지 규칙 */
.rs-seedadd { display: flex; align-items: center; gap: 8px; }
.rs-seedadd .rs-search { height: 40px; margin: 0; }
.rs-seedadd .rs-search-btn { height: 40px; margin: 0; white-space: nowrap; }
.rs-sl-badge.own { background: var(--pf, #ee4d2d); color: #fff; }
.rs-sl-badge.local { background: #64748b; color: #fff; }
/* 9/8 형: 상품 카드 월판매 옆 작은 알약 배지(추정·풀필). <b> 가 아닌 span — 카드 줄의 'b=16px 주황' 규칙에 안 덮이게. 파일 맨 끝 반응형 층보다 앞이지만 선택자가 더 구체적 */
.rs-card-row .rs-stat-month .rs-est, .rs-stat-month .rs-est { display: inline-block; vertical-align: middle; margin-left: 5px; padding: 1px 5px; border-radius: 999px; font-size: 9px; line-height: 12px; font-weight: 600; color: #0369a1; background: #e0f2fe; border: 1px solid #bae6fd; position: relative; top: -1px; }   /* 9/8 형: 색 있게(하늘색, 주황 X) */
.rs-card-row .rs-stat-month .rs-est.ful, .rs-stat-month .rs-est.ful { color: #b45309; background: #fef3c7; border-color: #fde68a; }   /* 풀필먼트(현지 창고) — Preferred 톤 */
/* 8/26 묶음4: 설정 좌우 2단 + 직접 추가 전용 줄(전역 검색창 규칙 안 탐 = 브라우저마다 높이 안 흔들림) */
.rs-set-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.rs-set-2col .rs-set-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 1100px) { .rs-set-2col { grid-template-columns: 1fr; } }
.rs-addrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.rs-addrow-in { box-sizing: border-box; height: 42px; padding: 0 14px; border: 1.5px solid var(--color-border-strong, #cbd5e1); border-radius: 10px; font-size: 14px; font-family: inherit; color: var(--color-text); background: #fff; min-width: 0; }
.rs-addrow-in:focus { outline: none; border-color: var(--pf, var(--color-primary)); box-shadow: 0 0 0 3px var(--pf-ring, rgba(238,77,45,.16)); }
.rs-addrow-btn { box-sizing: border-box; height: 42px; padding: 0 18px; border: none; border-radius: 10px; background: var(--pf, var(--color-primary)); color: #fff; font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rs-addrow-btn:hover:not(:disabled) { background: var(--pf-deep, var(--color-primary)); }
.rs-addrow-btn:disabled { opacity: .5; cursor: not-allowed; }

/* 판매 N개 이하 알약 (형 8/26) — 오른쪽 끝, 주문관리 필터 알약(orders-filter-pill) 규격 그대로 */
.rs-kbar .rs-maxsold-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 8px 0 14px; }
.rs-maxsold-pill input { width: 112px; height: 100%; border: 0; outline: 0; background: transparent; font: inherit; font-size: 13px; color: var(--color-text); padding: 0; -moz-appearance: textfield; }
.rs-maxsold-pill input::placeholder { color: var(--color-text-dim); }
.rs-maxsold-pill input::-webkit-outer-spin-button, .rs-maxsold-pill input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rs-maxsold-pill .rs-maxsold-txt { border: 0; background: transparent; font: inherit; font-weight: 700; color: var(--color-text); cursor: text; padding: 0; }
.rs-maxsold-pill .rs-maxsold-x { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--color-primary-bg, #f1f5f9); color: var(--color-text-secondary); cursor: pointer; padding: 0; }
.rs-maxsold-pill .rs-maxsold-x:hover { background: var(--pf, var(--color-primary)); color: #fff; }

/* ── 8/26 모바일·좁은 화면 수정 (형 이미지 3장 기준) ── */
/* 1) 메인 탭 5개: 글자 세로 쪼개짐 금지 — 한 줄 유지, 좁으면 옆 스크롤 */
/* 스크롤 = 샵관리 탭과 동일한 pftab-bar-scroll 규칙 그대로(형 8/26). 리서치 자체 스크롤 규칙 삭제 */
.rs-main-tabs.pftab-bar-scroll { gap: 0; padding: 0; }   /* pftab-bar 의 간격/패딩만 원래 탭줄 값으로 */
.rs-main-tabs .orders-main-tab { white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 720px) { .rs-main-tabs .orders-main-tab { padding: 10px 14px; font-size: 14px; } }
/* 2) 셀러 순위 숫자 3칸: PC = 표 칸 그대로(display:contents), 모바일 = 라벨 붙여 한 줄 */
.rs-sl-nums { display: contents; }
.rs-sl-num::before { content: attr(data-l); display: none; }
@media (max-width: 720px) {
  /* 🐞 원인: 312줄 모바일 그리드가 333줄 PC 7칸 규칙(뒤에 선언)에 덮여 폰에서도 7칸 → 오른쪽으로 삐져나감. 여기서 다시 확정 */
  .rs-sl-head, .rs-sl-row { grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-areas: 'r shop act' 'r nums nums' 'r top top'; gap: 8px 10px; padding: 12px 14px; }
  .rs-sl-row > * { min-width: 0; }
  .rs-sl-nums { display: flex; grid-area: nums; gap: 12px; flex-wrap: wrap; min-width: 0; }
  .rs-sl-num { font-size: 13px; }
  .rs-sl-actwrap { gap: 4px; }
  .rs-sl-act.rs-shop-btn { padding: 6px 7px; }
  .rs-sl-act.rs-shop-btn svg + * , .rs-sl-actwrap .rs-shop-btn { font-size: 0; gap: 0; }   /* 폰은 아이콘만(이름 칸 확보) */
  .rs-sl-actwrap .rs-shop-btn svg { width: 16px; height: 16px; }
  .rs-sl-num { display: inline-flex; align-items: baseline; gap: 4px; grid-area: auto; text-align: left; border: 0 !important; padding: 0 !important; }
  .rs-sl-num::before { display: inline; font-size: 11px; font-weight: 600; color: var(--color-text-secondary); }
  .rs-sl-div { align-self: auto; }
  .rs-sl-top { padding-left: 0; border-left: 0; min-width: 0; overflow: hidden; }
  .rs-sl-topname { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; overflow: hidden; }
}
/* 3) 카드 월판매/월매출: 좁으면 두 줄로 내려감(잘림 금지) — PC 6열·모바일 2열 공통 */
.rs-card-row.rs-card-stats { flex-wrap: wrap; row-gap: 2px; }
.rs-card-row.rs-card-stats > * { min-width: 0; }
/* 4) 판매 N개 이하 알약: 모바일은 검색줄 아래 왼쪽 */
@media (max-width: 720px) { .rs-kbar .rs-maxsold-pill { margin-left: 0; } }
@media (max-width: 720px) {
  /* 카드 버튼 글자 세로 쪼개짐 금지 */
  .rs-card-btns .rs-open-btn { white-space: nowrap; padding: 9px 2px; font-size: 13px; gap: 3px; }
  /* 가격 줄: 대분류가 안 들어가면 아래 줄로 */
  .rs-card-row:not(.rs-card-stats) { flex-wrap: wrap; row-gap: 0; }
  .rs-card-row:not(.rs-card-stats) .rs-card-loc { flex: 1 0 100%; text-align: left; margin-top: -2px; }   /* 폰은 대분류를 가격 아래 줄에(잘림 금지) */
  /* 셀러 행: 이름·위치줄은 잘라내지 말고 두 줄까지 */
  .rs-sl-img { width: 40px; height: 40px; }
  .rs-sl-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
  .rs-sl-loc { white-space: normal; }
}

/* ═══════════════════════════════════════════════════════════════════════
   ▣ 반응형 층 (8/26, 형: "특정 폭 몇 개가 아니라 모든 화면") — 이 아래가 최종 규칙.
   원칙: 화면 폭(@media) 숫자로 나누지 않고, 내용이 들어갈 칸의 폭(@container)으로 스스로 접힘.
   · 카드 = 최소 폭 기준(250px) 자동 배치. 카드 안 글자는 250px 기준 설계 → 어느 폭이든 한 줄.
   · 카드 칸이 250px 미만(폰 2열)일 때만 카드 자체가 판단해 월판매/월매출을 두 줄로.
   · 필터·검색 줄은 칸이 좁아지면 알약 스크롤 / 검색창 한 줄 통째로.
   · 셀러 표는 표가 못 들어가는 칸(<1000px)에서 3단 카드로.
   ═══════════════════════════════════════════════════════════════════════ */
.rs-page { container-type: inline-size; container-name: rs; }
.rs-card { container-type: inline-size; container-name: card; }

/* ── 카드 그리드: 최소 250px, 들어가는 만큼 (6·5·4… 화면이 정함) ── */
.rs-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
@container rs (max-width: 600px) { .rs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

/* ── 카드 안 = 250px 기준 한 줄 설계 ── */
.rs-card-body { padding: 12px 12px 12px; gap: 6px; }
.rs-card-name { font-size: 13.5px; min-height: 38px; }
.rs-card-row { gap: 6px; }
.rs-card-row .rs-card-price { font-size: 16.5px; }
.rs-card-row.rs-card-stats { flex-wrap: nowrap; }
.rs-card-row .rs-stat-month, .rs-card-row .rs-card-rev { font-size: 12px; }
.rs-card-row .rs-stat-month b, .rs-card-row .rs-card-rev b { font-size: 15px; letter-spacing: -.2px; }
.rs-card-row .rs-card-loc { font-size: 12px; }
.rs-card-btns .rs-open-btn { white-space: nowrap; padding: 8px 4px; font-size: 13px; }
/* 카드 칸이 좁을 때(폰 2열 등) — 카드가 스스로 판단 */
@container card (max-width: 235px) {
  .rs-card-row.rs-card-stats { flex-direction: column; align-items: flex-start; gap: 1px; }
  .rs-card-row:not(.rs-card-stats) { flex-wrap: wrap; row-gap: 0; }
  .rs-card-row:not(.rs-card-stats) .rs-card-loc { flex: 1 0 100%; text-align: left; margin-top: -2px; }
  .rs-card-name { font-size: 13px; }
}

/* ── 위쪽 줄들: 국가 · 샵등급 · 카테고리/검색 ── */
.rs-cb-s { display: none; }
.rs-kbar { row-gap: 8px; }
.rs-kbar-cats { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rs-kbar-search { display: flex; align-items: center; gap: 8px; flex: 1 1 320px; min-width: 0; }
.rs-kbar-search .rs-search { flex: 1 1 auto; min-width: 140px; max-width: 360px; }
.rs-kbar-search .rs-ext-recheck { margin-top: 0; border-color: var(--color-border-strong, #cbd5e1); color: var(--color-text-secondary); white-space: nowrap; flex: none; }
.rs-viewcount { color: var(--color-text-secondary); }
.rs-viewcount b { color: var(--color-text); font-weight: 800; }
.rs-viewsub { font-weight: 500; }
.rs-viewdesc.rs-viewcount { font-size: 13px; margin: 0 0 10px; }
@container rs (max-width: 640px) {
  /* 국가 4개 한 줄: 작게 + 짧은 이름 */
  .rs-filters { gap: 4px; flex-wrap: nowrap; }
  .rs-country-btn { height: 34px; padding: 0 8px; font-size: 13px; gap: 4px; border-radius: 9px; flex: 1 1 0; justify-content: center; min-width: 0; white-space: nowrap; }
  .rs-country-btn .rs-cb-s { white-space: nowrap; }
  .rs-cb-l { display: none; } .rs-cb-s { display: inline; }
  .rs-hide-narrow { display: none !important; }
  .rs-calc-btn { height: 34px; width: 34px; padding: 0; font-size: 0; gap: 0; flex: none; justify-content: center; border-radius: 9px; }   /* 폰은 계산기 아이콘만 */
  .rs-calc-btn svg { width: 17px; height: 17px; }
  .rs-kbar-search .rs-search { min-width: 90px; }
  /* 샵 등급 · 카테고리: 한 줄 알약, 넘치면 옆 스크롤 */
  .rs-typebar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .rs-typebar::-webkit-scrollbar { display: none; }
  .rs-type-chip { height: 30px; padding: 0 12px; font-size: 12.5px; flex: none; }
  .rs-kbar-cats { flex: 1 0 100%; overflow-x: auto; scrollbar-width: none; }
  .rs-kbar-cats::-webkit-scrollbar { display: none; }
  .rs-kbar-cats .rs-drop-btn { height: 32px; font-size: 12.5px; padding: 0 9px 0 11px; flex: none; }
  .rs-kbar-cats .rs-drop-lab { max-width: 110px; }
  /* 검색 = 자기 줄 통째 */
  .rs-kbar-search { flex: 1 0 100%; }
  .rs-kbar-search .rs-search { max-width: none; }
  .rs-kbar .rs-maxsold-pill { margin-left: 0; }
  .rs-kchips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .rs-kchips .orders-filter-pill { flex: none; }
  .rs-kbar .rs-viewhead-r { margin-left: 0; }
}

/* ── 셀러 표 → 3단 카드 (표가 못 들어가는 칸) ── */
.rs-sl-toplab { display: none; }
.rs-sl-topname { -webkit-line-clamp: 2; }
@container rs (max-width: 1000px) {
  .rs-sl-head { display: none !important; }
  .rs-sl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'shop act' 'nums nums' 'top top'; gap: 0 10px; padding: 12px 14px 12px 14px; position: relative; }
  .rs-sl-row > * { min-width: 0; }
  .rs-sl-rank { position: absolute; top: 8px; left: 8px; z-index: 1; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--pf, #ee4d2d); color: #fff; font-size: 11.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
  .rs-sl-shop { grid-area: shop; gap: 12px; }
  .rs-sl-img { width: 48px; height: 48px; border-radius: 12px; }
  .rs-sl-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; font-size: 14px; }
  .rs-sl-loc { white-space: normal; font-size: 11.5px; margin-top: 2px; }
  .rs-sl-act { grid-area: act; align-self: start; }
  .rs-sl-actwrap { gap: 4px; }
  .rs-sl-act.rs-shop-btn { padding: 7px 8px; font-size: 0; gap: 0; }
  .rs-sl-actwrap .rs-shop-btn svg { width: 16px; height: 16px; }
  /* 2단: 숫자 3칸 = 라벨 + 값, 위아래 구분선 */
  .rs-sl-nums { display: flex; grid-area: nums; gap: 0; margin: 10px 0 8px; border-top: 1px solid var(--color-border, #eef2f7); border-bottom: 1px solid var(--color-border, #eef2f7); padding: 8px 0; }
  .rs-sl-num { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; grid-area: auto; text-align: left; border: 0 !important; padding: 0 0 0 10px !important; font-size: 14px; white-space: nowrap; }
  .rs-sl-num + .rs-sl-num { border-left: 1px solid var(--color-border, #eef2f7) !important; }
  .rs-sl-num:first-child { padding-left: 0 !important; }
  .rs-sl-num::before { display: block; font-size: 11px; font-weight: 600; color: var(--color-text-secondary); }
  .rs-sl-div { align-self: auto; justify-content: flex-start; }
  /* 3단: 1등 상품 */
  .rs-sl-top { grid-area: top; padding-left: 0; border-left: 0; min-width: 0; overflow: hidden; gap: 10px; }
  .rs-sl-toplab { display: inline-flex; align-items: center; justify-content: center; flex: none; height: 20px; padding: 0 7px; border-radius: 6px; background: var(--pf-bg, #fdf3ef); color: var(--pf-deep, #c93a1c); font-size: 11px; font-weight: 800; }
  .rs-sl-topimg { width: 40px; height: 40px; }
  .rs-sl-topname { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; overflow: hidden; font-size: 12.5px; }
}
@container rs (max-width: 420px) {
  .rs-sl-num { font-size: 13px; }
  .rs-sl-img { width: 42px; height: 42px; }
}

/* ── 설정 2단 → 1단도 칸 기준 ── */
@container rs (max-width: 1100px) { .rs-set-2col { grid-template-columns: 1fr; } }

/* ── 신규 샵 목록 모달 ── */
.rs-modal-shops { width: 640px; }
.rs-shops-body { padding: 8px 10px; }
.rs-shops-row { display: grid; grid-template-columns: 28px 36px minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 10px; text-decoration: none; color: var(--color-text); }
.rs-shops-row:hover { background: var(--pf-hover, #fdeae4); }
.rs-shops-rank { font-size: 12.5px; font-weight: 800; color: var(--pf-deep, #c93a1c); text-align: center; }
.rs-shops-img { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; }
.rs-shops-name { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-shops-age { font-size: 12px; color: var(--color-text-secondary); white-space: nowrap; }
.rs-shops-rev { font-size: 13.5px; font-weight: 800; color: var(--pf-deep, #c93a1c); white-space: nowrap; }
.rs-shops-cnt { font-size: 12px; color: var(--color-text-secondary); white-space: nowrap; min-width: 44px; text-align: right; }
@media (max-width: 480px) { .rs-shops-row { grid-template-columns: 24px 32px minmax(0, 1fr) auto auto; gap: 8px; } .rs-shops-cnt { display: none; } }   /* 모달은 body 직속이라 @media (폰: 상품수 숨김, 이름 자리 확보) */
.rs-type-label { white-space: nowrap; flex: none; }   /* "카테고리"·"샵 등급" 라벨 세로 쪼개짐 금지 */

/* ── 8/26 2차 (형 9개): 배지 줄 · 폰 새로고침 아이콘 · 폰 한 줄 · 셀러 빼기 상자 · 탭 HScroll ── */
.rs-sl-shopinfo { gap: 2px; }
.rs-sl-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* 이름 = 한 줄, 길면 … (모든 폭) */
.rs-sl-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.rs-sl-badges .rs-sl-badge { margin-left: 0; }
@container rs (max-width: 1000px) {
  .rs-sl-name { display: block; -webkit-line-clamp: unset; white-space: nowrap; }
}
@container rs (max-width: 640px) {
  .rs-kbar-search .rs-ext-recheck { width: 36px; height: 36px; padding: 0; font-size: 0; gap: 0; justify-content: center; border-radius: 9px; }   /* 폰 = 아이콘만 */
  .rs-kbar-search .rs-ext-recheck svg { width: 16px; height: 16px; }
  .rs-kbar-search { flex: 1 1 0; min-width: 0; }   /* 검색·새로고침·판매 한 줄 */
  .rs-kbar-search .rs-search { min-width: 0; }
  .rs-kbar .rs-drop { flex: none; }
  .rs-kbar > .rs-drop .rs-drop-btn { height: 36px; font-size: 12.5px; padding: 0 9px 0 11px; }
  .rs-kbar .rs-viewhead-r { flex: 1 0 100%; }
}
.rs-exclbox .rs-addrow { margin-top: 4px; }
.rs-excl-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.rs-excl-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--color-border, #eef2f7); }
.rs-excl-row .rs-shops-img { width: 32px; height: 32px; }
.rs-main-tabs { margin-bottom: 0; }
.hscroll-wrap:has(> .rs-main-tabs) { margin-bottom: 20px; }

/* ── 모달 (형 8/26): 상단바·하단탭 위 · 높이 최대 75% · 가운데 · 폰 좌우 16px · 폰 맨 아래 [닫기] ── */
.rs-modal-backdrop { z-index: 10000; padding: 16px; }
.rs-modal { max-height: 75vh; max-height: 75dvh; width: min(92vw, 360px); }
.rs-modal-wide { width: min(94vw, 620px); }
.rs-modal-shops { width: min(94vw, 640px); }
.rs-modal-head { position: sticky; top: 0; z-index: 1; }
.rs-modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.rs-modal-foot-close { display: none; flex: 0 0 auto; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 46px; border: 0; border-top: 1px solid var(--color-border, #e5e7eb); background: #fff; color: var(--color-text); font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer; }
@media (max-width: 768px) {
  .rs-modal-backdrop { padding: 16px 16px 24px; }
  .rs-modal, .rs-modal-wide, .rs-modal-shops { width: 100%; max-height: 72vh; max-height: 72dvh; }
  .rs-modal-foot-close { display: inline-flex; }
}
/* 탭 밑줄이 2px 아래로 삐져나와(margin -2px) 세로 스크롤 2px 생기던 것 — 밑줄을 안쪽에 그려 삐져나옴 0 (모양 동일) */
.rs-main-tabs.pftab-bar-scroll { border-bottom: 0; box-shadow: inset 0 -2px 0 var(--color-border); }
.rs-main-tabs.pftab-bar-scroll .orders-main-tab { margin-bottom: 0; }

/* 설정 카드 = 제목 / 설명 / 입력 순 (형 8/26) */
.rs-set-title { margin-bottom: 2px; }
.rs-set-sec > .rs-set-desc { margin: 0 0 10px; line-height: 1.55; }
.rs-set-oneline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }

/* ── 8/26 3차: 무한 스크롤 · 검색 지우기 · 마진 계산기 떠 있는 버튼 ── */
.rs-more-sentinel { height: 48px; display: flex; align-items: center; justify-content: center; font-size: 12.5px; color: var(--color-text-secondary); }   /* 높이 고정 = 이어 붙일 때 화면 안 튐 */
.rs-searchwrap { position: relative; display: flex; flex: 1 1 auto; min-width: 0; }
.rs-searchwrap .rs-search { width: 100%; padding-right: 34px; }
.rs-search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--color-primary-bg, #f1f5f9); color: var(--color-text-secondary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.rs-search-clear:hover { background: var(--pf, var(--color-primary)); color: #fff; }
.rs-kbar-search .rs-search { max-width: 360px; }
/* 계산기: 오른쪽 아래 떠 있는 버튼 + 그 위로 열리는 패널 (뒤 화면 그대로 스크롤·클릭) */
.rs-calc-fab { position: fixed; right: 22px; bottom: 22px; z-index: 900; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--pf, var(--color-primary)); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 8px 22px rgba(15,23,42,.22); transition: transform .12s, box-shadow .12s; }
.rs-calc-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15,23,42,.26); }
.rs-calc-fab.on { background: var(--pf-deep, var(--color-primary)); }
.rs-calc-panel { position: fixed; right: 22px; bottom: 84px; z-index: 900; width: 360px; max-width: calc(100vw - 32px); max-height: min(70vh, 560px); display: none; flex-direction: column; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.25); border: 1px solid var(--color-border, #e5e7eb); }
.rs-calc-panel.open { display: flex; }
.rs-calc-panel .rs-modal-body { overflow-y: auto; }
/* 결과 표: 마진·이익률 글자 통일, 열 맞춤 */
.rs-calc-result { padding: 10px 12px; text-align: left; align-items: stretch; }
.rs-calc-table { width: 100%; border-collapse: collapse; }
.rs-calc-table th, .rs-calc-table td { padding: 7px 6px; font-size: 13px; }
.rs-calc-table thead th { text-align: right; color: var(--color-text-secondary); font-weight: 600; border-bottom: 1px solid var(--color-border, #e5e7eb); }
.rs-calc-table thead th:first-child { text-align: left; }
.rs-calc-table tbody th { text-align: left; color: var(--color-text-secondary); font-weight: 600; width: 64px; }
.rs-calc-table tbody td { text-align: right; font-size: 17px; font-weight: 800; color: var(--color-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-calc-table tbody td:last-child { color: var(--color-text-secondary); font-weight: 700; }   /* 환급전 = 글자색만 (소싱탭 규칙) */
.rs-calc-table td.neg, .rs-calc-table td.warn { color: #b91c1c !important; }
@media (max-width: 768px) {
  .rs-calc-fab { right: 14px; bottom: 80px; width: 48px; height: 48px; }
  .rs-calc-panel { right: 8px; left: 8px; bottom: 136px; width: auto; max-height: min(62vh, 520px); }
}

/* ── v2.0 수집 속도 + 24시간 그래프 (8/27) ── */
.rs-pace { margin-top: 4px; }
.rs-act { margin-top: 10px; border: 1px solid var(--color-border, #e8edf3); border-radius: 12px; padding: 10px 12px 8px; background: #fff; }
.rs-act-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--color-text-secondary); margin-bottom: 4px; }
.rs-act-wall { display: inline-flex; align-items: center; gap: 4px; color: #b91c1c; font-weight: 700; }
.rs-act-svg { width: 100%; height: 150px; display: block; }
.rs-act-grid { stroke: var(--color-border, #e8edf3); stroke-width: 1; }
.rs-act-axis { font-size: 10px; fill: var(--color-text-secondary); }
.rs-act-bar { fill: var(--pf, #ee4d2d); opacity: .85; }
.rs-act-bar.wall { fill: #b91c1c; opacity: 1; }
.rs-act-wallmark { font-size: 10px; font-weight: 800; fill: #b91c1c; }
.rs-act-ref { stroke-width: 1.5; stroke-dasharray: 4 4; }
.rs-act-ref.bad { stroke: #b91c1c; }
.rs-act-ref.ok { stroke: #15803d; }
.rs-act-foot { font-size: 12px; color: var(--color-text-secondary); margin-top: 4px; min-height: 18px; }
.rs-act-leg { display: inline-block; width: 14px; height: 0; border-top: 2px dashed; vertical-align: middle; margin: 0 2px; }
.rs-act-leg.bad { border-color: #b91c1c; } .rs-act-leg.ok { border-color: #15803d; }
/* ═══ ERP 공용 플랫폼 선택 버튼 표준 (형 확정 2026-07-17) ═══
   어느 페이지든 플랫폼 선택 버튼은 이 클래스만 사용: <div class="pftab-bar"><button class="pftab active">…
   양식: 로고 20px + 이름, 2px 테두리 알약 카드. 활성 = 그 플랫폼 브랜드색(테마 변수 --pf, 없으면 인디고).
   새 페이지·새 플랫폼도 예외 없음 — 새로 발명 금지. 모바일 가로스크롤은 pftab-bar-scroll 추가. */
.pftab-bar { display: flex; gap: 8px; padding: 8px 0; margin-bottom: 10px; flex-wrap: wrap; }
.pftab-bar-scroll { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.pftab-bar-scroll::-webkit-scrollbar { display: none; }
.pftab {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border: 2px solid var(--color-border); background: #fff; border-radius: 10px;
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--color-text-secondary);
  transition: all 0.12s ease; font-family: inherit; white-space: nowrap; flex-shrink: 0;
}
.pftab:hover:not(:disabled):not(.active) { border-color: var(--color-text-secondary); color: var(--color-text); background: #fff; }
/* ── 선택(토글) 버튼 공용 문법 (형 확정 7/17): 검색창 포커스와 동일 ──
   배경 흰색·글자 검정 유지, 테두리만 브랜드 + 링. 채움 금지. 실행 버튼(primary)만 채움.
   비활성 버튼은 호버 반응 금지. 링 변수 = --pf-ring (아래 정의) */
.pftab.active {
  font-weight: 700; background: #fff; color: var(--color-text);
  border-color: var(--pf, var(--color-primary));
  box-shadow: var(--pf-ring);
}
:root { --pf-ring: 0 0 0 3px color-mix(in srgb, var(--color-primary) 18%, transparent); }
body[data-pf] { --pf-ring: 0 0 0 3px color-mix(in srgb, var(--pf) 18%, transparent); }
.pftab:hover:not(:disabled):not(.active) { border-color: var(--pf, var(--color-primary)); color: var(--color-text); background: #fff; }
.pftab:disabled { opacity: 0.5; cursor: not-allowed; }
.pftab:disabled:hover { border-color: var(--color-border); color: var(--color-text-secondary); }

/* 공용 가로스크롤 화살표 (HScroll) */
.hscroll-wrap { position: relative; }
.hscroll-arrow { position: absolute; top: 50%; transform: translateY(-50%); font-size: 18px; font-weight: 700;
  color: var(--color-text-secondary); pointer-events: none; line-height: 1;
  background: linear-gradient(to right, transparent, #ffffffcc 40%); padding: 2px 2px 4px 14px; }
.hscroll-arrow.left { left: 0; background: linear-gradient(to left, transparent, #ffffffcc 40%); padding: 2px 14px 4px 2px; }
.hscroll-arrow.right { right: 0; }



/* ============================================
   ERP Global Styles
   ============================================ */
:root {
  /* Colors — Soft Indigo + Slate palette
     Primary: indigo-500. 회색은 slate(약간 푸르스름)로 통일해 인디고와 자연스럽게 어울림. */
  --color-bg: #fcfcfd;              /* 거의 흰 + 미세한 cool tint. 회색끼 최소화 */
  --color-row-zebra: #eef1f5;       /* 시트 zebra odd 행 — 흰 카드 안에서 명확히 구분 */
  --color-row-hover: #dee5ff;       /* 시트 row hover — 약간 진한 indigo tint */
  --color-surface: #ffffff;          /* 카드/표 */
  --color-sidebar: #0f172a;          /* slate-900 — sidebar/topbar 통일감 */
  --color-sidebar-hover: #1e293b;    /* slate-800 */
  --color-sidebar-active: #334155;   /* slate-700 */
  --color-sidebar-text: #94a3b8;     /* slate-400 */
  --color-sidebar-text-active: #ffffff;

  --color-primary: #6366f1;          /* indigo-500 — 메인 강조 */
  --color-primary-hover: #4f46e5;    /* indigo-600 — 호버 시 진하게 */
  --color-primary-bg: #eef2ff;       /* indigo-50 — 옅은 강조 배경/호버 */
  --color-primary-border: #c7d2fe;   /* indigo-200 — 약한 강조 보더 */
  --color-primary-light: #eef2ff;    /* 호환용 alias */

  --color-text: #0f172a;             /* slate-900 — 본문 */
  --color-text-dim: #475569;         /* slate-600 — 부제목 */
  --color-text-secondary: #64748b;   /* slate-500 — 부가 정보 */
  --color-text-muted: #94a3b8;       /* slate-400 — 더 옅은 텍스트/placeholder */

  --color-border: #e2e8f0;           /* slate-200 — 일반 보더 */
  --color-border-strong: #cbd5e1;    /* slate-300 — 강조 보더 */

  --color-success: #10b981;          /* emerald-500 */
  --color-success-bg: #ecfdf5;       /* emerald-50 */
  --color-warning: #f59e0b;          /* amber-500 */
  --color-warning-bg: #fffbeb;       /* amber-50 */
  --color-danger: #ef4444;           /* red-500 */
  --color-danger-bg: #fef2f2;        /* red-50 */
  --color-info: #3b82f6;             /* blue-500 */
  --color-info-bg: #eff6ff;

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed: 72px;
  --topbar-height: 56px;
  --bottomtab-height: 60px;

  /* Typography */
  --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 13px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}
/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html, body, #root {
  height: 100%;
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}
/* 세로 스크롤바가 필요/불필요해질 때마다 본문 가로 너비가 변동되어
   ResizeObserver가 컬럼 너비를 다시 계산하면서 표가 흔들리는 현상 방지.
   스크롤바 자리를 항상 예약 → 가로 너비 항상 일정. */
html {
  scrollbar-gutter: stable;
}
a {
  text-decoration: none;
  color: inherit;
}
button {
  font-family: var(--font-family);
  cursor: pointer;
  border: none;
  background: none;
}
/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #d1d3db;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #a0a3b1;
}
/* number input — 브라우저 기본 스피너 (위아래 화살표) 숨김. 모든 number input 전역 적용. */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}
/* ===== 전역 검색창 통일 (#8) =====
   placeholder 에 '검색' 이 들어간 input = 검색창. 돋보기 아이콘 + 옅은 배경 + 둥근 테두리로
   일반 입력칸과 명확히 구분. 인라인 편집 셀(pur-cell-input 등)은 제외. */
input[placeholder*="검색"]:not(.pur-cell-input):not(.inv-comp-search-input) {
  /* 검색창 전역 규격 (형 확정 7/18): 흰 배경 + 회색 테두리, 포커스 = 테두리 강조+링. 인디고 틴트 폐기 */
  background-color: #fff;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
  background-repeat: no-repeat;
  background-position: 12px center;
  border: 1.5px solid var(--color-border-strong, #cbd5e1) !important;
  border-radius: 18px !important;
  padding-left: 36px !important;
  transition: background-color .12s, border-color .12s, box-shadow .12s;
}
input[placeholder*="검색"]:not(.pur-cell-input):not(.inv-comp-search-input)::placeholder { color: #64748b; }
/* 진회색 — 연보라는 안 보임 */
input[placeholder*="검색"]:not(.pur-cell-input):not(.inv-comp-search-input):focus {
  background-color: #fff;
  border-color: var(--color-primary, #6366f1) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary, #6366f1) 15%, transparent);
}
/* ── iOS 입력 포커스 자동확대 방지 (전역) ──
   iOS Safari 는 글자 16px 미만 input/select/textarea 를 누르면 화면을 자동 확대함.
   (viewport maximum-scale 는 iOS 가 접근성 위해 무시 → 안 먹음. 16px 만이 확실한 해결.)
   모바일에서만 16px 강제 → 자동확대 안 됨, 손가락 핀치줌은 유지. */
@media (max-width: 768px) {
  input, select, textarea { font-size: 16px !important; }
}
