/* =====================================================
   온동네 총판관리자 - 공통 스타일
   메인 컬러: 차콜 네이비 #252B3B (온동네 홈페이지 기준)
   ===================================================== */

:root {
  /* ── 브랜드 컬러 */
  --primary:        #E8192C;       /* 온동네 레드 (CTA·강조) */
  --primary-dark:   #C0121F;
  --primary-light:  #fff0f1;

  /* ── 탭 활성 색상 변수 (업종별 오버라이드 가능) */
  --tab-active-color:   #252B3B;
  --tab-active-bg:      #f0f2f5;
  --tab-active-border:  #252B3B;
  --tab-hover-color:    #252B3B;

  /* ── 차콜 시스템 (메인 UI 컬러) */
  --charcoal:       #252B3B;       /* 온동네 홈 메인 차콜 → 헤더·사이드바 */
  --charcoal-dark:  #1a1f2e;       /* 더 진한 차콜 (hover) */
  --charcoal-mid:   #353d52;       /* 사이드바 hover, 서브 배경 */
  --charcoal-light: #f0f2f5;       /* 본문 배경 */

  /* ── 텍스트 */
  --ink:            #1e293b;
  --ink-60:         #475569;
  --ink-40:         #94a3b8;

  /* ── 레이아웃 */
  --header-bg:      #252B3B;       /* 헤더: 차콜 */
  --titlebar-height: 36px;          /* 상단 타이틀바 높이 */
  --navbar-height:  52px;           /* 대메뉴 네비바 높이 */
  --header-height:  88px;           /* 타이틀바 + 네비바 합산 */
  --sidebar-width:  220px;
  --sidebar-bg:     #ffffff;       /* 사이드바: 흰색 */
  --sidebar-border: #e5e7eb;
  --sidebar-text:   #252B3B;
  --sidebar-active: rgba(37,43,59,0.08);

  /* ── 테이블 */
  --table-header:   #353d52;       /* 테이블 헤더: 차콜 */
  --table-header-text: #e2e8f0;

  /* ── 공통 */
  --line:           #e5e7eb;
  --cream:          #f0f2f5;       /* 본문 배경 (차콜 라이트) */
  --white:          #ffffff;

  /* ── 시맨틱 */
  --success:        #16a34a;
  --warning:        #d97706;
  --danger:         #dc2626;
  --info:           #2563eb;

  /* ── 이펙트 */
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.12);
  --radius:         6px;
  --transition:     all 0.2s ease;
}

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

body {
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  font-size: 13px;
  color: var(--ink);
  background: var(--cream);
  min-height: 100vh;
}

/* ===================================================
   상단 타이틀바 (로고 · 사용자정보 · 로그아웃)
   =================================================== */
.top-titlebar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--titlebar-height);
  background: #ffffff;              /* 흰색 배경 */
  z-index: 1100;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.top-titlebar .tb-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 160px;
}
.top-titlebar .tb-logo {
  height: 20px;
  width: auto;
  object-fit: contain;
  display: block;
}
.top-titlebar .tb-logo-text {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--charcoal);
  display: none;  /* 로고 이미지 로드 실패 시 표시 */
}
/* .tb-bi-label — BI 문구 삭제로 사용 안 함 */
.top-titlebar .tb-bi-label {
  display: none;
}
.top-titlebar .tb-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.tb-info-label {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  font-weight: 400;
}
.tb-divider {
  color: #d1d5db;
  font-size: 12px;
}
.tb-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
/* 마스터본사 — 골드 계열 */
.tb-level-badge.tb-level-master {
  background: #fef9ee;
  border: 1px solid #fcd34d;
  color: #b45309;
}
/* 총판 — 블루 계열 */
.tb-level-badge.tb-level-dist {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
}
.tb-user-info {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}
.tb-user-info i {
  font-size: 12px;
  color: #94a3b8;
}
.tb-user-info .tb-username {
  color: #1e293b;
  font-weight: 600;
}
.tb-user-info .tb-user-id {
  color: #94a3b8;
  font-weight: 400;
  font-size: 10.5px;
  margin-left: 2px;
}
.top-titlebar .tb-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  min-width: 160px;
  justify-content: flex-end;
}
.tb-logout-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #64748b;
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 12px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  transition: all 0.15s;
  white-space: nowrap;
  cursor: pointer;
  background: #f8fafc;
}
.tb-logout-btn:hover {
  color: var(--danger);
  background: #fff0f1;
  border-color: #fca5a5;
}

/* ===================================================
   대메뉴 네비바 — 차콜 #252B3B
   =================================================== */
.top-header {
  position: fixed;
  top: var(--titlebar-height);  /* 타이틀바 아래에 위치 */
  left: 0; right: 0;
  height: var(--navbar-height);
  background: var(--charcoal);
  z-index: 1000;
  overflow: visible;            /* 드롭다운이 헤더 밖으로 넘쳐 보이도록 */
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* =====================================================
   특산물(local) 업종 — 틸(Teal) 테마  #2A9D8F
   메인 : #2A9D8F   진한 : #227A6F   연한배경 : #E6F7F5
   텍스트 강조 : #0f766e
   ===================================================== */

/* ── CSS 변수 재정의 ── */
body.biz-local {
  --primary:           #2A9D8F;
  --primary-dark:      #227A6F;
  --primary-light:     #E6F7F5;
  --charcoal:          #227A6F;
  --charcoal-dark:     #1a5c56;
  --charcoal-mid:      #2A9D8F;
  --table-header:      #2A9D8F;
  --tab-active-color:  #0f766e;
  --tab-active-bg:     #f0fdfb;
  --tab-active-border: #2A9D8F;
  --tab-hover-color:   #0d9488;
}

/* ── 상단 헤더 네비바 ── */
body.biz-local .top-header {
  background: linear-gradient(135deg, #2A9D8F 0%, #227A6F 100%);
  box-shadow: 0 2px 12px rgba(42,157,143,0.5);
}
body.biz-local .top-nav .nav-item {
  color: rgba(255,255,255,0.80);
}
body.biz-local .top-nav .nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.14);
  border-radius: 4px;
}
body.biz-local .top-nav .nav-item.active {
  color: #fff;
  border-bottom-color: #a8edea;
  border-bottom-width: 3px;
  background: rgba(255,255,255,0.20);
  font-weight: 700;
}
body.biz-local .logout-btn {
  color: rgba(255,255,255,0.75);
}
body.biz-local .logout-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.12);
}
body.biz-local .user-name {
  color: rgba(255,255,255,0.85);
}

/* ── 업종 선택 드롭다운 ── */
body.biz-local .biz-selector {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.30);
  color: #fff;
}
body.biz-local .biz-selector:hover {
  background: rgba(255,255,255,0.26);
}
body.biz-local #bizSelector i.fa-leaf {
  color: #a8edea;
}

/* ── 사이드바 브랜드/메뉴 ── */
body.biz-local .sb-brand-icon { background: #2A9D8F; }
body.biz-local .sb-on          { color: #2A9D8F; }
body.biz-local .sub-menu-label { color: #2A9D8F; }

body.biz-local .sb-menu-item.active {
  color: #0f766e;
  background: #ccf0eb;
  font-weight: 700;
  border-left: 3px solid #2A9D8F;
}
body.biz-local .sb-menu-item.active::before { color: #2A9D8F; }
body.biz-local .sb-menu-item:hover {
  background: #e6faf8;
  color: #0f766e;
}
body.biz-local .sb-menu-item .badge-new {
  background: #2A9D8F;
}
body.biz-local .sb-subtab-btn.active {
  background: #d0f5ee;
  color: #0f766e;
  border-left-color: #2A9D8F;
  font-weight: 700;
}
body.biz-local .sb-subtab-btn:hover {
  background: #e6faf8;
  color: #0f766e;
}
body.biz-local .sidebar-toggle:hover {
  background: #e6faf8;
  color: #0f766e;
}

/* ── 탭 ── */
body.biz-local .tab-btn.active {
  color: #0f766e;
  border-bottom-color: #2A9D8F;
  background: #f0fdfb;
  font-weight: 700;
}
body.biz-local .tab-btn:hover { color: #0f766e; }

/* ── 공통 버튼 ── */
body.biz-local .btn-primary-custom,
body.biz-local .btn-search,
body.biz-local .btn-sp-search,
body.biz-local .btn-save,
body.biz-local .store-select-btn {
  background: #2A9D8F !important;
  color: #fff !important;
  border-color: #2A9D8F !important;
}
body.biz-local .btn-primary-custom:hover,
body.biz-local .btn-search:hover,
body.biz-local .btn-sp-search:hover,
body.biz-local .btn-save:hover,
body.biz-local .store-select-btn:hover {
  background: #227A6F !important;
  border-color: #227A6F !important;
}
body.biz-local .btn-reset,
body.biz-local .btn-secondary-custom,
body.biz-local .btn-back,
body.biz-local .btn-sp-reset {
  border-color: #b2d8d4 !important;
  color: #0f766e !important;
}
body.biz-local .btn-reset:hover,
body.biz-local .btn-secondary-custom:hover,
body.biz-local .btn-back:hover,
body.biz-local .btn-sp-reset:hover {
  background: #e6faf8 !important;
  border-color: #2A9D8F !important;
  color: #0f766e !important;
}

/* ── 검색 필터 포커스 ── */
body.biz-local .filter-select:focus,
body.biz-local .filter-input:focus,
body.biz-local .f-input:focus,
body.biz-local .f-select:focus,
body.biz-local .f-textarea:focus,
body.biz-local .sp-search-input:focus {
  border-color: #2A9D8F !important;
  box-shadow: 0 0 0 3px rgba(42,157,143,0.12) !important;
}
body.biz-local .sp-search-input {
  border-color: #2A9D8F !important;
}

/* ── 테이블 헤더 ── */
body.biz-local .data-table thead th {
  background: #2A9D8F;
  color: #fff;
}
body.biz-local .table-count strong { color: #2A9D8F; }
body.biz-local .data-table tbody tr:hover { background: #f0fdfb; }

/* ── 인라인 apply-table (온동네 신청관리 등) ── */
body.biz-local table thead th,
body.biz-local .apply-table thead th {
  background: #2A9D8F !important;
  color: #fff !important;
}

/* ── 페이지네이션 버튼 ── */
body.biz-local .pg-btn.active {
  background: #2A9D8F !important;
  color: #fff !important;
  border-color: #2A9D8F !important;
}
body.biz-local .pg-btn:hover:not(:disabled) {
  border-color: #2A9D8F !important;
  color: #2A9D8F !important;
}

/* ── 상태 배지 ── */
body.biz-local .badge-new-item,
body.biz-local .badge-match,
body.biz-local .badge-expose,
body.biz-local .badge-recv {
  background: #d0f5ee !important;
  color: #0f766e !important;
  border-color: #2A9D8F !important;
}
body.biz-local .badge-normal {
  background: #d0f5ee !important;
  color: #0f766e !important;
  border: 1px solid #a8edea !important;
}

/* ── store-info-bar (선택 가맹점 바) ── */
body.biz-local .store-info-bar.has-store {
  border-color: #2A9D8F !important;
  background: #f0fdfb !important;
}
body.biz-local .store-avatar { background: #2A9D8F !important; }
body.biz-local .store-id-badge {
  background: #d0f5ee !important;
  color: #0f766e !important;
}

/* ── KPI 카드 ── */
body.biz-local .apply-kpi-card { border-color: #e0f5f2 !important; }
body.biz-local .apply-kpi-val  { color: #0f766e !important; }

/* ── 링크 / 텍스트 강조 ── */
body.biz-local a.breadcrumb-bar a:hover,
body.biz-local .breadcrumb-bar a:hover { color: #2A9D8F; }
body.biz-local .bc-cur { color: #0f766e; }

/* ── 대시보드 퀵메뉴 카드 버튼 ── */
body.biz-local .qm-btn-red {
  background: #2A9D8F !important;
  color: #fff !important;
  border-color: #2A9D8F !important;
}
body.biz-local .qm-btn-red:hover {
  background: #227A6F !important;
  border-color: #227A6F !important;
}
body.biz-local .qm-btn-gray,
body.biz-local .qm-btn-green,
body.biz-local .qm-btn-blue {
  color: #0f766e !important;
  border-color: #b2d8d4 !important;
}
body.biz-local .qm-btn-gray:hover,
body.biz-local .qm-btn-green:hover,
body.biz-local .qm-btn-blue:hover {
  background: #e6faf8 !important;
  border-color: #2A9D8F !important;
  color: #0f766e !important;
}

/* ── 대시보드 퀵메뉴 아이콘 영역 ── */
body.biz-local .qm-card:hover { box-shadow: 0 6px 20px rgba(42,157,143,0.18); }
body.biz-local .qm-icon-local  { color: #2A9D8F !important; }

/* ── 요약 카드 ── */
body.biz-local .summary-icon.si-teal {
  background: #d0f5ee;
  color: #2A9D8F;
}
body.biz-local .kpi-sub { color: #2A9D8F; }

/* ── 팝업 선택된 행 ── */
body.biz-local .pop-selected,
body.biz-local .sp-selected {
  background: #d0f5ee !important;
}

/* ── 이벤트 현황 배지 ── */
body.biz-local .evt-badge-active {
  background: #d0f5ee;
  color: #0f766e;
  border: 1px solid #2A9D8F;
}

/* ── 스크롤바 (WebKit) ── */
body.biz-local ::-webkit-scrollbar-thumb { background: #a8d5d0; }
body.biz-local ::-webkit-scrollbar-thumb:hover { background: #2A9D8F; }

/* ── 라디오 버튼 강조색 ── */
body.biz-local input[type="radio"] { accent-color: #2A9D8F; }
body.biz-local input[type="checkbox"] { accent-color: #2A9D8F; }

/* ── CSS 변수를 쓰지 않는 하드코딩 버튼 보완 ── */
/* store-apply, store-apply-edit, store-customer 등 인라인 #252B3B 버튼 */
body.biz-local .btn-search,
body.biz-local [class*="btn"][style*="252B3B"],
body.biz-local [class*="btn"][style*="background:#252B3B"],
body.biz-local [class*="btn"][style*="background: #252B3B"] {
  background: #2A9D8F !important;
  border-color: #2A9D8F !important;
  color: #fff !important;
}
body.biz-local .btn-search:hover { background: #227A6F !important; }

/* ── 필터 reset 버튼 ── */
body.biz-local .btn-reset {
  background: #fff !important;
  color: #0f766e !important;
  border-color: #b2d8d4 !important;
}
body.biz-local .btn-reset:hover {
  background: #e6faf8 !important;
  border-color: #2A9D8F !important;
}

/* ── 총판관리 btn-save (primary 사용) ── */
body.biz-local .btn-save {
  background: #2A9D8F !important;
  color: #fff !important;
  border-color: #2A9D8F !important;
  box-shadow: 0 2px 6px rgba(42,157,143,0.25) !important;
}
body.biz-local .btn-save:hover { background: #227A6F !important; }

/* ── 이벤트 등록/수정 페이지 ── */
body.biz-local .event-submit-btn,
body.biz-local .btn-event-save {
  background: #2A9D8F !important;
  color: #fff !important;
}
body.biz-local .event-submit-btn:hover,
body.biz-local .btn-event-save:hover { background: #227A6F !important; }

/* ── table-count strong (테이블 건수 강조) ── */
body.biz-local .table-count strong,
body.biz-local [id*="Total"],
body.biz-local .count-badge { color: #2A9D8F !important; }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  padding: 0 16px;
  overflow: visible;
}
.header-left {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 0;
  min-width: 0;
  overflow: visible;
}

/* 업종 선택 드롭다운 */
.biz-wrap {
  position: relative;
  margin-right: 12px;
}
.biz-selector {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.13);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 20px;
  padding: 5px 13px 5px 11px;
  color: rgba(255,255,255,0.95);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  user-select: none;
}
.biz-selector:hover { background: rgba(255,255,255,0.22); }
.biz-selector .biz-arrow {
  width: 20px; height: 20px;
  background: rgba(255,255,255,0.18);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  transition: transform .2s;
}
.biz-wrap.open .biz-selector .biz-arrow { transform: rotate(180deg); }

/* 드롭다운 메뉴 — fixed 포지션으로 어떤 overflow 클리핑도 무력화 */
.biz-dropdown {
  display: none;
  position: fixed;   /* absolute → fixed: header overflow 클리핑 완전 우회 */
  /* top/left는 JS에서 bizSelector의 getBoundingClientRect()로 동적 계산 */
  min-width: 160px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;  /* 아이템 hover 효과 border-radius 클리핑용 */
  z-index: 99999;    /* fixed이므로 최상위 보장 */
  animation: bizDropIn .15s ease;
}
@keyframes bizDropIn {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.biz-wrap.open .biz-dropdown { display: block; }

.biz-drop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  cursor: pointer;
  transition: background .12s;
  white-space: nowrap;
}
.biz-drop-item:hover { background: #f8fafc; }
.biz-drop-item.active { font-weight: 700; color: #1e293b; }
.biz-drop-item .biz-icon {
  width: 28px; height: 28px;
  background: #f1f5f9;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: #475569;
  flex-shrink: 0;
}
.biz-drop-item .biz-check {
  margin-left: auto;
  color: #22c55e;
  font-size: 14px;
  opacity: 0;
}
.biz-drop-item.active .biz-check { opacity: 1; }

/* 상단 네비게이션 */
.top-nav {
  display: flex;
  align-items: center;
  height: var(--navbar-height);
  gap: 0;
  flex: 1;
  min-width: 0;
}
.top-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 100%;
  padding: 0 16px;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
}
.top-nav .nav-item:hover {
  color: rgba(255,255,255,0.95);
  background: rgba(255,255,255,0.07);
}
.top-nav .nav-item.active {
  color: #fff;
  border-bottom-color: var(--primary);
  background: rgba(232,25,44,0.10);
  font-weight: 700;
}

/* ── delivery 업종: 메뉴가 넘칠 때 가로 스크롤 ── */
body.biz-delivery .top-header {
  overflow: visible;  /* hidden → visible: 드롭다운이 헤더 바깥으로 나올 수 있도록 */
}
body.biz-delivery .header-inner {
  overflow-x: auto;   /* 가로 스크롤은 header-inner에서만 처리 */
  overflow-y: visible; /* 드롭다운이 아래로 펼쳐지도록 visible 유지 */
  padding-bottom: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}
body.biz-delivery .header-inner::-webkit-scrollbar {
  height: 3px;
}
body.biz-delivery .header-inner::-webkit-scrollbar-track {
  background: transparent;
}
body.biz-delivery .header-inner::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
}
body.biz-delivery .header-left {
  overflow: visible;
  flex-shrink: 0;
}
body.biz-delivery .top-nav {
  flex-shrink: 0;
  flex-wrap: nowrap;
}
body.biz-delivery .top-nav .nav-item {
  padding: 0 11px;
  font-size: 12px;
  gap: 4px;
  flex-shrink: 0;
}
body.biz-delivery .top-nav .nav-item i {
  font-size: 11px;
}

/* =====================================================
   B2C쇼핑몰(b2cmall) 업종 — 블랙 테마  #111111
   메인 : #111111   포인트 : #E8192C   연한배경 : #F8F8F8
   ===================================================== */
body.biz-b2cmall {
  --primary:           #E8192C;
  --primary-dark:      #b91c1c;
  --primary-light:     #FFF1F2;
  --charcoal:          #111111;
  --charcoal-dark:     #000000;
  --charcoal-mid:      #222222;
  --table-header:      #111111;
  --tab-active-color:  #b91c1c;
  --tab-active-bg:     #FFF1F2;
  --tab-active-border: #E8192C;
  --tab-hover-color:   #E8192C;
}

body.biz-b2cmall .top-header {
  background: #111111;                   /* 검정 배경 */
  box-shadow: 0 2px 10px rgba(0,0,0,0.6);
  overflow: visible;
}
body.biz-b2cmall .header-inner {
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.20) transparent;
}
body.biz-b2cmall .header-left { overflow: visible; flex-shrink: 0; }
body.biz-b2cmall .top-nav     { flex-shrink: 0; flex-wrap: nowrap; }
body.biz-b2cmall .top-nav .nav-item {
  padding: 0 14px;
  font-size: 12.5px;
  gap: 5px;
  flex-shrink: 0;
  color: rgba(255,255,255,0.75);
}
body.biz-b2cmall .top-nav .nav-item i { font-size: 11px; }
body.biz-b2cmall .top-nav .nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}
body.biz-b2cmall .top-nav .nav-item.active {
  color: #fff;
  border-bottom-color: #E8192C;          /* 빨간 포인트 언더라인 */
  background: rgba(232,25,44,0.12);
  font-weight: 700;
}
body.biz-b2cmall .biz-selector {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.22);
  color: #fff;
}
body.biz-b2cmall .biz-selector:hover { background: rgba(255,255,255,0.18); }
body.biz-b2cmall .sb-brand-icon { background: #E8192C; }
body.biz-b2cmall .sb-on          { color: #E8192C; }
body.biz-b2cmall .sub-menu-label { color: #E8192C; }
body.biz-b2cmall .sb-menu-item.active {
  color: #b91c1c;
  background: #FFF1F2;
  font-weight: 700;
  border-left: 3px solid #E8192C;
}

/* ── nav-item 비활성(disabled) — B2C쇼핑몰: 완전히 숨김 ── */
.top-nav .nav-item-disabled {
  display: none;   /* 숨김 처리 */
}

/* top-nav 안의 nav-user-group — 타이틀바로 이전, 호환용 숨김 */
.top-nav .nav-user-group { display: none; }
.header-right { display: none; }
/* 메뉴바(header) 안의 brand-logo — 타이틀바에서 별도 표시하므로 숨김 */
.top-header .brand-logo { display: none; }
.user-name {
  color: rgba(255,255,255,0.80);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  padding: 0 8px;
}
.logout-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius);
  transition: var(--transition);
  white-space: nowrap;
}
.logout-btn:hover { color: #fff; background: rgba(255,255,255,0.10); }

/* 브랜드 로고 */
.brand-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  margin-right: 16px;
  flex-shrink: 0;
}
.brand-logo img { height: 32px; width: auto; object-fit: contain; }
.logo-fallback {
  display: flex;
  align-items: center;
  gap: 0;
  line-height: 1;
}
.logo-text-wordmark {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.logo-text-main {
  font-size: 17px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.3px;
  line-height: 1;
}
.logo-text-sub {
  font-size: 8.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.5px;
  line-height: 1;
}
/* 구버전 호환 */
.logo-text-on   { color: #fff; }
.logo-text-dong { color: #fff; }

/* ===================================================
   메인 래퍼
   =================================================== */
.main-wrapper {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* ===================================================
   사이드바 — 흰색 배경
   =================================================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  overflow: hidden;   /* 스크롤은 .sidebar-nav 가 담당, 배너는 항상 하단 고정 */
  z-index: 900;
  transition: width 0.3s, min-width 0.3s, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.collapsed { width: 0; min-width: 0; }

/* 사이드바 브랜드 */
.sidebar-brand {
  display: none;
}
.sidebar-brand img { height: 56px; width: auto; object-fit: contain; }
.sidebar-logo-fallback { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.sb-logo-box {
  display: flex;
  align-items: center;
  font-size: 22px;
  font-weight: 900;
}
.sb-on   { color: var(--primary); }
.sb-dong { color: #252B3B; }
.sb-sub  { font-size: 9px; color: #94a3b8; font-weight: 500; letter-spacing: 0.5px; }

/* 페이지 타이틀 바 */
.page-title-bar {
  background: #f8fafc;
  border-bottom: 1px solid var(--sidebar-border);
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  word-break: break-all;
  letter-spacing: 0.3px;
}

/* 서브 메뉴 레이블 */
.sub-menu-label {
  padding: 14px 14px 6px;
  font-size: 9.5px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* 사이드바 네비게이션 */
.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 6px 8px 16px; }
.sb-menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sb-menu-item:before {
  content: '•';
  color: #cbd5e1;
  font-size: 14px;
  flex-shrink: 0;
}
.sb-menu-item:hover {
  background: #f1f5f9;
  color: #1e293b;
}
.sb-menu-item.active {
  background: #fff0f1;
  color: var(--primary);
  font-weight: 700;
}
.sb-menu-item.active:before { color: var(--primary); }

/* 사이드바 비활성(disabled) 서브메뉴 */
.sb-menu-disabled {
  opacity: 0.38;
  cursor: not-allowed !important;
  pointer-events: none;
  color: var(--sidebar-text) !important;
  background: none !important;
}
.sb-menu-disabled:before {
  content: '•';
  color: #cbd5e1;
  font-size: 14px;
  flex-shrink: 0;
}

/* 사이드바 하위 탭 */
.sb-subtab-group {
  margin: 6px 0 4px 10px;
  border-left: 2px solid #e5e7eb;
  padding-left: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sb-subtab-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: none;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}
.sb-subtab-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}
.sb-subtab-btn.active {
  background: #fff0f1;
  color: var(--primary);
  font-weight: 700;
}
.sb-menu-item .badge-new {
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  margin-left: 4px;
  flex-shrink: 0;
}

/* 2차 탭바 숨김 */
.sub2-tab-bar { display: none !important; }
.sub2-tab-btn { display: none !important; }

/* 사이드바 접기 */
.sidebar-toggle {
  padding: 10px 14px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 11.5px;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}
.sidebar-toggle:hover { color: #475569; background: #f1f5f9; }

/* ===================================================
   콘텐츠 영역
   =================================================== */
.content-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: calc(100vh - var(--header-height));
  transition: margin-left 0.3s;
  background: var(--cream);
}
.content-area.full { margin-left: 0; }

/* ===================================================
   페이지 공통
   =================================================== */
.page-wrapper { padding: 20px; }
.page-header {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.page-header h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

/* ===================================================
   탭 메뉴
   =================================================== */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--line);
  margin-bottom: 20px;
  background: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
.tab-btn {
  padding: 11px 20px;
  border: none;
  background: none;
  color: var(--ink-60);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--ink); background: var(--cream); }
.tab-btn.active {
  color: var(--tab-active-color, var(--primary));
  font-weight: 700;
  border-bottom-color: var(--tab-active-border, var(--primary));
  background: var(--tab-active-bg, var(--white));
}

/* ===================================================
   필터 영역
   =================================================== */
.filter-box {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-60);
  min-width: 70px;
}
.filter-select, .filter-input {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 10px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
  outline: none;
  transition: border-color 0.2s;
}
.filter-select:focus, .filter-input:focus { border-color: var(--charcoal); }
.filter-input { min-width: 160px; }

/* ===================================================
   버튼
   =================================================== */
.btn-primary-custom {
  background: var(--charcoal);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 7px 16px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-primary-custom:hover { background: var(--charcoal-dark); }

.btn-secondary-custom {
  background: var(--white);
  color: var(--ink-60);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 16px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-secondary-custom:hover { border-color: var(--charcoal-mid); color: var(--ink); }

/* ===================================================
   테이블
   =================================================== */
.table-box {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8f9fa;
}
.table-count { font-size: 12px; color: var(--ink-60); }
.table-count strong { color: var(--charcoal); font-weight: 700; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  background: var(--table-header);     /* 차콜 테이블 헤더 */
  color: var(--table-header-text);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border-right: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
}
.data-table thead th:last-child { border-right: none; }
.data-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink);
  text-align: center;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f5f6f8; }
.data-table .empty-row td {
  padding: 40px;
  color: var(--ink-40);
  font-size: 13px;
}

/* ===================================================
   상태 배지
   =================================================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-scheduled { background: #f1f5f9; color: var(--charcoal); border: 1px solid #e2e8f0; }
.badge-sent      { background: #f1f5f9; color: var(--charcoal); border: 1px solid #e2e8f0; }
.badge-failed    { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }
.badge-cancel    { background: #f8fafc; color: #94a3b8; border: 1px solid #e2e8f0; }
.badge-event-discount { background: #f1f5f9; color: var(--ink); border: 1px solid #e2e8f0; }
.badge-event-coupon   { background: #f1f5f9; color: var(--ink); border: 1px solid #e2e8f0; }
.badge-event-point    { background: #f1f5f9; color: var(--ink); border: 1px solid #e2e8f0; }
.badge-event-notice   { background: #f1f5f9; color: var(--ink); border: 1px solid #e2e8f0; }

/* ── 공통 페이잔액 음수 표시 ── */
.pay-negative { color: #E8192C !important; font-weight: 700; }
.pay-zero     { color: #94a3b8 !important; }
.pay-positive { color: var(--ink) !important; }

/* ── 공통 상태 배지 (차콜 톤) ── */
.bs-active   { background: #f1f5f9; color: var(--charcoal); border: 1px solid #e2e8f0; }
.bs-pause    { background: #f8fafc; color: #64748b;         border: 1px solid #e2e8f0; }
.bs-inactive { background: #f8fafc; color: #94a3b8;         border: 1px solid #e2e8f0; }

/* ── 공통 소속총판 뱃지 ── */
.badge-branch-common {
  display: inline-block; background: #f1f5f9; color: var(--charcoal);
  border: 1px solid #e2e8f0; border-radius: 4px;
  padding: 1px 6px; font-size: 11px; font-weight: 600;
}

/* ── 공통 온동네 상점명 컬러 ── */
.td-ondongne-name { font-size: 12px; color: var(--charcoal); font-weight: 500; }

/* ===================================================
   카드
   =================================================== */
.card-box {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-box-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-box-title i { color: var(--charcoal); }

/* ===================================================
   폼
   =================================================== */
.form-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-60);
}
.form-label .required { color: var(--primary); margin-left: 2px; }
.form-control-custom {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.form-control-custom:focus {
  border-color: var(--charcoal);
  box-shadow: 0 0 0 3px rgba(37,43,59,0.08);
}
.form-textarea { height: 100px; resize: vertical; padding: 10px 12px; }

/* ===================================================
   통계 카드
   =================================================== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #f1f5f9; color: #475569; }
.stat-icon.green  { background: #f1f5f9; color: #475569; }
.stat-icon.red    { background: #f1f5f9; color: #475569; }
.stat-icon.orange { background: #f1f5f9; color: #475569; }
.stat-icon.charcoal { background: #f1f5f9; color: var(--charcoal); }
.stat-val  { font-size: 20px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.stat-lbl  { font-size: 11.5px; color: var(--ink-40); margin-top: 2px; }

/* ===================================================
   날짜 배지
   =================================================== */
.date-badge-lg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-60);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 12px;
  font-weight: 500;
}

/* 가맹점명 링크 */
.store-name-link {
  color: var(--charcoal);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.store-name-link:hover { text-decoration: underline; color: var(--charcoal-dark); }

/* 페이지 사이즈 */
.page-size-bar {
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
}
.page-size-bar select {
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 8px;
  font-size: 12px;
  font-family: inherit;
}

/* 홈 환영 */
.welcome-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height));
  padding: 40px 20px;
}
.welcome-inner { text-align: center; max-width: 600px; }
.welcome-inner h2 { font-size: 18px; font-weight: 700; margin: 16px 0 8px; color: var(--ink); }
.quick-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 28px;
}
.quick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink-60);
  font-size: 12.5px;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.quick-card i { font-size: 22px; color: var(--charcoal); }
.quick-card:hover {
  border-color: var(--charcoal);
  color: var(--charcoal);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.quick-card:hover i { color: var(--charcoal-dark); }
.quick-card.highlight {
  border-color: var(--charcoal);
  background: #f0f2f5;
}
.quick-card.highlight i   { color: var(--charcoal); }
.quick-card.highlight span { color: var(--charcoal); }

/* ===================================================
   반응형
   =================================================== */
@media (max-width: 1024px) {
  .sidebar { width: 200px; min-width: 200px; }
  .content-area { margin-left: 200px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ===================================================
   모바일 햄버거 버튼
   =================================================== */
#mobileMenuBtn {
  display: none;  /* 기본: 데스크톱에서 숨김 */
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.90);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
  order: -1;   /* 맨 앞에 표시 */
  margin-right: 8px;
}
#mobileMenuBtn:hover { background: rgba(255,255,255,0.22); }

/* 타이틀바(흰색)에 놓일 때 오버라이드 */
#topTitleBar #mobileMenuBtn {
  background: #f1f5f9;
  color: var(--charcoal);
  border: 1px solid #e2e8f0;
}
#topTitleBar #mobileMenuBtn:hover { background: #e2e8f0; }

/* ===================================================
   모바일 사이드바 오버레이
   =================================================== */
#sidebarOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 899;
  opacity: 0;
  /* transition은 display:block 상태에서만 작동하므로 JS에서 타이밍 제어 */
  transition: opacity 0.28s ease;
}
#sidebarOverlay.visible {
  display: block;
  opacity: 1;
}

/* ===================================================
   모바일 전용 미디어쿼리 (≤ 768px)
   =================================================== */
@media (max-width: 768px) {
  /* 햄버거 버튼 표시 */
  #mobileMenuBtn { display: flex; }

  /* 상단 타이틀바 */
  .top-titlebar {
    padding: 0 12px;
  }
  /* 타이틀바 중앙 정보 (레벨·사용자명) — 모바일에서 숨김 */
  .top-titlebar .tb-center { display: none; }
  /* 로그아웃 버튼 텍스트 숨기고 아이콘만 */
  .top-titlebar .tb-logout-btn span { display: none; }
  .top-titlebar .tb-right { min-width: auto; }

  /* 대메뉴 네비바 — 가로 스크롤 */
  .top-header { overflow-x: auto; overflow-y: visible; }
  .header-inner {
    padding: 0 12px;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
  }
  .header-inner::-webkit-scrollbar { display: none; }
  .header-left { flex-shrink: 0; overflow: visible; }
  .top-nav { flex-shrink: 0; flex-wrap: nowrap; }
  .top-nav .nav-item {
    padding: 0 10px;
    font-size: 11.5px;
    flex-shrink: 0;
  }
  .top-nav .nav-item span { display: none; }   /* 아이콘만 표시 */
  .top-nav .nav-item i { font-size: 14px; }

  /* 업종 선택 드롭다운 — 라벨 숨김 */
  .biz-selector #bizLabel { display: none; }
  .biz-selector { padding: 5px 8px; }
  .biz-selector .biz-arrow { display: none; }

  /* 사이드바 — 드로어 패턴 */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;   /* 오버레이(899) + header(1000) 위 */
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* 콘텐츠 영역 — 사이드바 없이 전체 폭 */
  .content-area { margin-left: 0 !important; }

  /* 페이지 래퍼 패딩 축소 */
  .page-wrapper { padding: 12px; }

  /* 통계 카드 — 2열 */
  .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* 퀵 카드 — 2열 */
  .quick-cards { grid-template-columns: repeat(2, 1fr); }

  /* 데이터 테이블 — 가로 스크롤 */
  .table-box { overflow-x: auto; }

  /* 필터 행 — 세로 적층 */
  .filter-row { flex-wrap: wrap; gap: 8px; }
  .filter-input { min-width: 120px; }

  /* 폼 행 — 세로 적층 */
  .form-row { flex-direction: column; gap: 10px; }
}
