/* ═══════════════════════════════════════════════════════════
   셀러메이트 - Cafe24 상품 자동화
   ═══════════════════════════════════════════════════════════ */

/* ─── Web Fonts ──────────────────────────────────────────── */
/* Pretendard (SIL OFL) - 자체 호스팅, https://github.com/orioncactus/pretendard */
@font-face {
  font-family: 'Pretendard';
  src: url('/fonts/PretendardVariable.woff2') format('woff2-variations');
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

/* ─── Reset & Variables ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:   #4f46e5;
  --primary-h: #4338ca;
  --danger:    #ef4444;
  --danger-h:  #dc2626;
  --warning:   #f59e0b;
  --success:   #10b981;
  --primary-50: #eef2ff;
  --gray-50:   #f9fafb;
  --gray-100:  #f3f4f6;
  --gray-200:  #e5e7eb;
  --gray-400:  #9ca3af;
  --gray-500:  #6b7280;
  --gray-600:  #4b5563;
  --gray-700:  #374151;
  --gray-800:  #1f2937;
  --white:     #ffffff;
  /* 사이드바/토스트 전용 고정 표면색 - 테마와 무관하게 항상 어두운 표면.
     --gray-800이 "본문 텍스트색"과 "사이드바 배경색" 두 역할을 겸하고 있어서
     다크모드에서 --gray-800을 밝게 재정의하면 사이드바가 깨진다 - 그래서 분리. */
  --surface-dark: #1f2937;
  --sidebar-w: 220px;
  --header-h:  60px;
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --radius:    8px;
  --font:      'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: light dark;
}

html, body { height: 100%; font-family: var(--font); font-size: 14px; color: var(--gray-800); background: var(--gray-100); }

/* ─── Layout ──────────────────────────────────────────────── */
body { display: flex; }

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface-dark);
  color: #d1d5db;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar-logo {
  padding: 20px 16px;
  font-size: 18px;
  font-weight: 700;
  /* var(--white)를 쓰면 안 됨 — 그 토큰은 다크모드에서 #1a2233로 반전되는데(카드/배경용),
     사이드바는 --surface-dark로 항상 어두운 고정 배경이라 로고 글자가 어두운 배경 위에
     어두운 글자가 되어버림(2026-08-13 발견). 사이드바 자체 색상(#d1d5db 등)처럼 리터럴 값 사용. */
  color: #ffffff;
  border-bottom: 1px solid #374151;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-menu { list-style: none; padding: 12px 0; flex: 1; }

.menu-item {
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 6px;
  margin: 2px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  transition: background .15s, color .15s;
}
/* #374151는 고정 어두운 배경(테마 무관)이라 글자도 var(--white) 대신 리터럴 흰색 사용
   (사이드바 로고와 같은 원인의 버그, 2026-08-13 발견) */
.menu-item:hover    { background: #374151; color: #ffffff; }
.menu-item.active   { background: var(--primary); color: var(--white); }
.menu-icon          { display: inline-flex; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #374151;
}

.mall-id-badge {
  background: #374151;
  color: #9ca3af;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── 사이드바 내 모바일 연결 폼 (데스크톱에서 숨김) ──────── */
.sidebar-connect-form { display: none; }
@media (max-width: 767px) {
  .sidebar-connect-form {
    display: block;
    margin-top: 10px;
  }
  .sidebar-connect-form input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #4b5563;
    background: #374151;
    color: white;
    font-size: 13px;
    outline: none;
  }
  .sidebar-connect-form input::placeholder { color: #9ca3af; }
  .sidebar-connect-form input:focus { border-color: var(--primary); }
}

/* ─── 모바일 "쇼핑몰 연결" 안내 배너 ──────────────────────────
   연결 폼이 햄버거 메뉴 안에 숨어있어 첫 진입자가 못 찾던 문제 대응.
   JS(renderMobileConnectBanner)가 모바일 + 미연결 상태일 때만 display:flex로 켠다. */
.mobile-connect-banner {
  align-items: center;
  gap: 8px;
  margin: 10px 14px 0;
  padding: 10px 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 13px;
  color: #1e40af;
}
.mcb-arrow { font-size: 16px; line-height: 1; }
.mcb-text  { flex: 1; }
.mcb-close {
  background: none;
  border: none;
  color: #1e40af;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
}
@media (min-width: 768px) {
  .mobile-connect-banner { display: none !important; }
}

/* ─── Top Header ──────────────────────────────────────────── */
.top-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-header h1 { font-size: 18px; font-weight: 600; }

.header-actions { display: flex; gap: 8px; align-items: center; }
.header-actions input {
  padding: 7px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  width: 200px;
  outline: none;
}
.header-actions input:focus { border-color: var(--primary); }

/* ─── Tab Content ─────────────────────────────────────────── */
.tab-content { display: none; padding: 24px; flex: 1; }
.tab-content.active { display: block; }

/* ─── Card ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, opacity .15s, transform .1s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.btn:active     { transform: scale(.97); }
.btn:disabled   { opacity: .5; cursor: not-allowed; }

.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover   { background: var(--primary-h); }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover    { background: var(--danger-h); }
.btn-warning  { background: var(--warning);  color: #fff; }
.btn-warning:hover   { background: #d97706; }
.btn-secondary { background: var(--gray-200); color: var(--gray-800); }
.btn-secondary:hover { background: var(--gray-200); filter: brightness(.95); }
.btn-outline  {
  background: var(--white);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}
.btn-outline:hover { background: var(--gray-50); }

.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-lg  { padding: 10px 20px; font-size: 14px; }

/* ─── Table ───────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
  white-space: nowrap;
}
.data-table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-600);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody tr:last-child td { border-bottom: none; }

.empty-row { text-align: center; color: var(--gray-400); padding: 32px !important; }

/* ─── Search Bar ──────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.search-bar input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.search-bar input:focus { border-color: var(--primary); }

/* ─── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0 4px;
}
#page-info { font-size: 13px; color: var(--gray-600); }

/* ─── Badge ───────────────────────────────────────────────── */
.badge {
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: var(--success); }
.badge-warning { background: var(--warning); }
.badge-danger  { background: var(--danger); }
.badge-gray    { background: var(--gray-400); }

/* ─── Option Groups ───────────────────────────────────────── */
.option-group-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.option-group-item input[type="text"] {
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.option-group-item input[type="text"]:focus { border-color: var(--primary); }
.option-group-name  { width: 150px; font-weight: 500; }
.option-group-values { flex: 1; min-width: 200px; width: 100%; }
.option-group-label { font-size: 12px; color: var(--gray-600); margin-bottom: 4px; }
.btn-remove-group {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
  line-height: 1;
}

/* ─── Combinations Table ──────────────────────────────────── */
#combo-table input[type="number"] {
  width: 100px;
  padding: 5px 8px;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  font-size: 12px;
}

/* ─── Apply Section ───────────────────────────────────────── */
.apply-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-100);
}
.apply-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.apply-mode-tabs { display: flex; gap: 16px; margin-bottom: 10px; }
.apply-mode-tabs label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
#apply-product-nos {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  margin-top: 8px;
  outline: none;
}

/* ─── Bulk Form ───────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--gray-600); }
.form-group select,
.form-group input[type="number"],
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="datetime-local"]{
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  min-width: 180px;
  width: 100%;
  max-width: 360px;
  background: var(--white);
  color: var(--gray-700);
  box-sizing: border-box;
  transition: border-color .15s;
}

/* 위 .form-group 계열 외에 배경을 명시적으로 지정 안 한 나머지 입력 필드들
   (검색바, 옵션그룹 인풋, 예약작업 상품번호, 콤보 재고, jobs 필터 select) -
   지정 안 하면 브라우저 기본(흰 배경)을 쓰게 돼서 다크모드에서 눈부시게 튄다. */
.search-bar input,
.header-actions input,
.option-group-item input[type="text"],
#apply-product-nos,
#combo-table input[type="number"],
.jobs-filter select {
  background: var(--white);
  color: var(--gray-700);
}
.form-group select:focus,
.form-group input:focus { border-color: var(--primary); }

/* datetime-local 캘린더 아이콘만 앱 색상으로 */
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  background-image: 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='%234f46e5' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-size: 14px 14px;
  background-repeat: no-repeat;
  background-position: center;
  width: 18px;
  height: 18px;
  cursor: pointer;
  opacity: .65;
  transition: opacity .15s;
}
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

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

.input-with-suffix { display: flex; align-items: center; gap: 0; }
/* .form-group input[type="number"]의 border-radius:6px(전체)가 특이도가 같거나 더 높아서
   여길 이길 때가 있었음 — 오른쪽 모서리가 둥글게 남아 옆의 "개 이하" 박스와 이어지는 부분이
   어긋나 보이던 버그(2026-08-13, 사용자 발견: "input 옆에 개 이하 이게 깨져있어").
   속성 셀렉터를 추가해 특이도를 명확히 더 높여서 항상 이기게 함. */
.input-with-suffix input[type="number"] { border-radius: 6px 0 0 6px !important; flex: 1; min-width: 0; }
.input-with-suffix span {
  padding: 8px 10px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-left: none;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  color: var(--gray-600);
}

.radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-card {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color .15s, background .15s;
  min-width: 160px;
}
.radio-card:hover   { border-color: var(--primary); background: var(--primary-50); }
.radio-card input[type="radio"] { accent-color: var(--primary); }
.radio-content { display: flex; flex-direction: column; gap: 2px; }
.radio-content strong { font-size: 13px; }
.radio-content small  { color: var(--gray-400); font-size: 11px; }

.sub-form { padding: 16px; background: var(--gray-50); border-radius: var(--radius); margin-top: 4px; }

.preview-box {
  margin-top: 10px;
  padding: 10px 14px;
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 6px;
  font-size: 12px;
  color: #78350f;
}

.hint { font-size: 11px; color: var(--gray-400); display: block; margin-top: 4px; }

/* ─── Template Grid ───────────────────────────────────────── */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }

.template-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  position: relative;
}
.template-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.template-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.template-card .template-options { font-size: 12px; color: var(--gray-600); line-height: 1.6; }
.template-card .btn-delete-template {
  position: absolute;
  top: 8px; right: 8px;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px;
}
.template-card .btn-delete-template:hover { color: var(--danger); }

.empty-state {
  text-align: center;
  padding: 32px;
  color: var(--gray-400);
  font-size: 14px;
}

/* ─── Jobs Table ──────────────────────────────────────────── */
.jobs-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.jobs-header .card-title { margin-bottom: 0; }
.jobs-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.jobs-filter select {
  padding: 6px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.jobs-filter select:focus { border-color: var(--primary); }

.auto-refresh-label { display: flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; color: var(--gray-600); }

/* Progress Bar */
.progress-bar-wrap {
  background: var(--gray-200);
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
  width: 120px;
  display: inline-block;
  vertical-align: middle;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 10px;
  transition: width .3s;
}
.progress-bar.completed { background: var(--success); }
.progress-bar.failed    { background: var(--danger); }

/* Status Badge */
.status-badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.status-pending      { background: #e5e7eb; color: #374151; }
.status-processing   { background: #dbeafe; color: #1d4ed8; }
.status-completed    { background: #d1fae5; color: #065f46; }
.status-failed       { background: #fee2e2; color: #991b1b; }
.status-partial      { background: #fef9c3; color: #854d0e; }
.status-rolled-back  { background: #fef3c7; color: #92400e; }

/* ─── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 24px;
  min-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ─── Toast ───────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface-dark);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: slideIn .25s ease;
  max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); color: #1c1917; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── Checkbox ────────────────────────────────────────────── */
input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }

/* ─── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ─── Plan Badge (사이드바 플랜 표시) ─────────────────────── */
/* 클릭 시 요금제 안내 모달(둘러보기 모드)이 열림 - app.js의 plan-badge 클릭 리스너 참고 */
.plan-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 3px 8px;
  border-radius: 10px;
  margin-bottom: 4px;
  text-align: center;
  cursor: pointer;
  transition: opacity .15s;
}
.plan-badge:hover { opacity: .75; }
.plan-free     { background: var(--gray-200); color: var(--gray-600); }
.plan-pro      { background: #dbeafe; color: #1d4ed8; }
.plan-business { background: #ede9fe; color: #6d28d9; }
.plan-trial    { background: #dcfce7; color: #15803d; }

/* ─── Plan Lock icon ──────────────────────────────────────── */
.plan-lock { font-size: 11px; margin-left: auto; opacity: .7; }

/* ─── Upgrade Modal ───────────────────────────────────────── */
.upgrade-plan-card {
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  position: relative;
  transition: border-color .2s;
}
.upgrade-plan-card.highlight {
  border-color: var(--primary);
  background: var(--primary-50);
}
/* 둘러보기 모드(showUpgradeModal 인자 없이 호출)에서 현재 이용 중인 플랜 카드 표시 */
.upgrade-plan-card.current-plan {
  border-color: var(--gray-400);
  background: var(--gray-50);
}
.upgrade-plan-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
}
.upgrade-plan-name  { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.upgrade-plan-price { font-size: 16px; font-weight: 800; color: var(--primary); margin-bottom: 10px; }
.upgrade-plan-price small { font-size: 11px; font-weight: 400; color: var(--gray-500); }
.upgrade-plan-features {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
  text-align: left;
  line-height: 1.8;
}

/* ─── 일괄 수정 실행 결과 메시지 ────────────────────────────── */
.bulk-result-message { font-size: 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.bulk-result-link { color: var(--primary); font-size: 13px; text-decoration: none; }
.upload-result-message { font-size: 14px; display: flex; align-items: center; gap: 6px; }

/* ─── 선택 드롭다운 빈 상태 / 하단 버튼 ─────────────────────── */
.selection-dropdown-empty { color: var(--gray-400); }
.selection-dropdown-footer-btn { flex: 1; }
.selection-dropdown-clear-btn { background: var(--danger); color: white; border: none; }

/* ─── 전역: 가로 오버플로 차단 ───────────────────────────── */
html, body { max-width: 100%; overflow-x: hidden; }
.main-content { max-width: 100%; overflow-x: hidden; }
/* 테이블은 wrapper 안에서만 스크롤 */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ═══════════════════════════════════════════════════════════
   모바일 반응형 (≤767px) - 햄버거 메뉴 + 360px 지원
   ═══════════════════════════════════════════════════════════ */

/* ─── 햄버거 버튼 (데스크톱 숨김) ─────────────────────────── */
.btn-hamburger {
  display: none;                  /* 데스크톱: 숨김 */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;                    /* 터치 영역 충분히 확보 */
  height: 44px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  z-index: 60;                    /* 헤더(50)보다 위 */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: #374151;            /* var() 대신 직접 값 — 상속 문제 방지 */
  transition: transform .25s, opacity .25s;
  pointer-events: none;           /* 클릭 이벤트 버튼으로만 */
}

/* 열렸을 때 X 모양 */
body.sidebar-open .btn-hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.sidebar-open .btn-hamburger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
body.sidebar-open .btn-hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── 사이드바 오버레이 (모바일용 딤처리) ───────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 140;
  opacity: 0;
  transition: opacity .25s;
}
body.sidebar-open .sidebar-overlay {
  display: block;
  opacity: 1;
}

/* ─── 모바일 미디어쿼리 ────────────────────────────────────── */
@media (max-width: 767px) {

  /* 사이드바: 기본 오프스크린, 열리면 슬라이드인 */
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    transition: transform .25s ease;
    z-index: 150;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }

  /* 메인 콘텐츠: 사이드바 공간 없애기 */
  .main-content { margin-left: 0; }

  /* 햄버거 버튼 표시 */
  .btn-hamburger { display: flex; }

  /* ── 헤더 레이아웃 재구성 ─────────────────────────────────
     [☰ 44px] [h1 고정] [빈공간 flex:1] [mall 뱃지]
     h1에 flex:1 주면 버튼 터치 영역 침범 → flex:1 제거
  ──────────────────────────────────────────────────────── */
  .top-header {
    padding: 0 10px;
    gap: 0;
    justify-content: flex-start;  /* space-between → flex-start */
  }
  .top-header h1 {
    font-size: 15px;
    flex: none;                   /* flex:1 제거 → 버튼 영역 침범 방지 */
    margin-left: 4px;
    white-space: nowrap;
  }
  /* 헤더 액션을 오른쪽 끝으로 밀기 */
  .header-actions {
    margin-left: auto;
    gap: 6px;
  }

  /* 모바일에서 연결폼 숨기고 연결된 mall 뱃지만 표시 */
  #mall-id-input { display: none; }
  #btn-connect   { display: none; }
  #mall-id-display {
    display: inline-block !important;
    font-size: 11px;
    padding: 4px 8px;
  }

  /* 카드 패딩 축소 */
  .card { padding: 14px; }

  /* 테이블: min-width 제거 → wrapper 안에서만 스크롤 */
  .data-table { min-width: 0; width: max-content; }
  .data-table th, .data-table td { padding: 8px 8px; font-size: 11px; white-space: nowrap; }

  /* 폼 행: 세로 쌓기 */
  .form-row { flex-direction: column; gap: 12px; }

  /* 라디오 카드 그룹: 2열 (display:grid가 빠져있으면 grid-template-columns가 아무 효과 없음).
     .radio-card의 데스크톱용 min-width:160px를 그대로 두면 1fr 트랙도 grid 아이템의
     min-content(=160px)보다 못 줄어들어(flex의 min-width:auto와 같은 계열의 문제) 320px가
     293px 안팎인 카드 컨테이너를 넘쳐 가로 스크롤이 생긴다(2026-09-01, 일괄수정/예약작업
     탭에서 실측 확인 — 문서 전체 스크롤은 안 생기고 카드 내부에서만 넘쳐 눈에 덜 띄었다). */
  .radio-group { display: grid; grid-template-columns: 1fr 1fr; }
  .radio-card  { min-width: 0; }

  /* 버튼 그룹: 세로 쌓기 */
  .card-actions { flex-direction: column; }
  .card-actions .btn { width: 100%; justify-content: center; }

  /* 서브폼 패딩 */
  .sub-form { padding: 14px; }

  /* 검색바 */
  .search-bar { flex-wrap: wrap; }
  .search-bar input { flex: 1; min-width: 0; }

  /* 페이지네이션 */
  .pagination { gap: 8px; }

  /* jobs 헤더 세로 쌓기 */
  .jobs-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .jobs-filter { flex-wrap: wrap; gap: 8px; width: 100%; }
  .jobs-filter select { flex: 1; min-width: 0; }

  /* 업그레이드 모달: 플랜 카드 세로 쌓기 */
  /* .modal의 데스크톱용 min-width:360px가 그대로 남아있으면 320px 폭 기기에서
     모달이 뷰포트보다 넓어져 왼쪽이 화면 밖으로 잘려 나간다(2026-09-01 실측 확인 —
     modal-overlay가 position:fixed라 document 레벨 스크롤 감지로는 안 걸리는 사각지대였음). */
  .modal { margin: 12px; padding: 20px 16px; min-width: 0; max-width: calc(100vw - 24px); }
  #modal-upgrade .upgrade-plan-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   선택 상품 전역 공유 UI - 칩 / 드롭다운 / 배너
   ═══════════════════════════════════════════════════════════ */

/* ─── 선택 칩 (헤더 상시 표시) ────────────────────────────── */
.selection-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  user-select: none;
  transition: background .15s;
}
.selection-chip:hover { background: var(--primary-h); }
.chip-clear {
  background: rgba(255,255,255,.25);
  border: none;
  color: white;
  border-radius: 50%;
  width: 17px;
  height: 17px;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  line-height: 1;
  transition: background .15s;
}
.chip-clear:hover { background: rgba(255,255,255,.45); }

/* ─── 선택 드롭다운 (칩 클릭 시 상품 목록) ─────────────────── */
.selection-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 260px;
  max-width: 340px;
  max-height: 280px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 200;
}
.selection-dropdown-list {
  overflow-y: auto;
  flex: 1;
}
.selection-dropdown-item {
  padding: 7px 14px;
  font-size: 12px;
  color: var(--gray-700);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.selection-dropdown-item:hover { background: var(--gray-50); }
.selection-dropdown-item .item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.selection-dropdown-item .item-no {
  color: var(--gray-400);
  font-size: 11px;
  flex-shrink: 0;
}
.selection-dropdown-footer {
  border-top: 1px solid var(--gray-100);
  padding: 8px 14px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.selection-dropdown-header {
  padding: 8px 14px 6px;
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 600;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}

/* ─── 선택 배너 (각 탭 상단) ──────────────────────────────── */
.selection-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #1e40af;
}
.banner-icon { font-size: 15px; flex-shrink: 0; }
.banner-text { flex: 1; line-height: 1.4; }
.banner-text strong { font-weight: 700; }
.banner-goto {
  font-size: 11px;
  color: #3b82f6;
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
  background: none;
  border: none;
  padding: 0;
}
.banner-apply {
  background: var(--primary);
  color: white;
  border: none;
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.banner-apply:hover { background: var(--primary-h); }
.banner-dismiss {
  background: none;
  border: none;
  color: #93c5fd;
  font-size: 15px;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  transition: color .15s;
}
.banner-dismiss:hover { color: #1e40af; }

@media (max-width: 767px) {
  .selection-banner { flex-wrap: wrap; }
  .banner-apply { width: 100%; text-align: center; justify-content: center; }
  .selection-chip { font-size: 11px; padding: 4px 8px 4px 10px; }
  .selection-dropdown { left: auto; right: 0; transform: none; min-width: 220px; }
}

/* ─── 상품목록 하단 고정 액션바 (2026-08-13) ───────────────────
   상품 선택 시 "다음에 뭘 할 수 있는지"를 목록 화면 그 자리에서 안내.
   #tab-products에 있을 때만 노출 - updateProductActionbar()(app.js)가
   App.currentTab / App.selectedProducts를 기준으로 is-visible 클래스를 토글한다. */
.product-actionbar {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  box-shadow: var(--shadow-md);
  transform: translateY(100%);
  transition: transform .2s ease;
}
.product-actionbar.is-visible { transform: translateY(0); }
.product-actionbar-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
}
.product-actionbar-count strong { color: var(--primary); font-size: 15px; }
.product-actionbar-actions { display: flex; gap: 8px; flex-shrink: 0; }

@media (max-width: 767px) {
  .product-actionbar { left: 0; padding: 12px 14px; gap: 10px; }
  .product-actionbar-count { font-size: 12px; }
}


/* ─── 무료 플랜 일괄수정 쿼터 뱃지 ───────────────────────────── */
.bulk-quota-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(255,255,255,.18);
  color: #d1fae5;
  margin-left: auto;
}
.bulk-quota-badge.quota-full {
  background: rgba(239,68,68,.25);
  color: #fca5a5;
}

/* ─── 업데이트 공지 배너 ───────────────────────────────────── */
.announcement-banner {
  background: var(--primary-50);
  border-left: 3px solid var(--primary);
  color: #1e3a8a;
  padding: 9px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  flex-shrink: 0;
}
.announcement-icon { flex-shrink: 0; transition: opacity .2s ease; }
.announcement-text { flex: 1; line-height: 1.5; transition: opacity .2s ease; }
.announcement-text.is-fading,
.announcement-icon.is-fading { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .announcement-icon, .announcement-text { transition: none; }
}
.announcement-close {
  background: none;
  border: none;
  color: rgba(30,58,138,.5);
  font-size: 18px;
  cursor: pointer;
  padding: 0 2px;
  transition: color .15s;
  flex-shrink: 0;
  line-height: 1;
}
.announcement-close:hover { color: #1e3a8a; }
@media (max-width: 767px) {
  .announcement-banner { padding: 9px 14px; }
}

/* ─── 체험 배너 ───────────────────────────────────────────── */
.trial-banner {
  background: #ecfdf5;
  border-left: 3px solid var(--success);
  color: #065f46;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  flex-shrink: 0;
}
.trial-banner-text { flex: 1; line-height: 1.5; }
.trial-banner-text strong { font-size: 13.5px; }
.trial-features {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 3px;
}
.trial-feature-chip {
  background: #ffffff;
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
}
.trial-banner-days {
  background: #ffffff;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.trial-banner-close {
  background: none;
  border: none;
  color: rgba(6,95,70,.5);
  font-size: 18px;
  cursor: pointer;
  padding: 0 2px;
  transition: color .15s;
  flex-shrink: 0;
  line-height: 1;
}
.trial-banner-close:hover { color: #065f46; }
.trial-email-capture {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.trial-email-capture span { font-size: 12px; color: #065f46; }
#trial-email-input {
  padding: 5px 10px;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  min-width: 200px;
  background: #ffffff;
  color: #065f46;
}
#trial-email-input:focus { border-color: var(--success); }
.trial-email-later {
  background: none;
  border: none;
  color: rgba(6,95,70,.6);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.trial-email-later:hover { color: #065f46; }
@media (max-width: 767px) {
  .trial-banner { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .trial-banner-days { order: -1; }
}

/* ─── 온보딩 카드 ─────────────────────────────────────────── */
.onboarding-card {
  background: var(--primary-50);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.onboarding-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 14px;
}
.onboarding-steps {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.onboarding-step {
  flex: 1;
  min-width: 150px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid #dbeafe;
}
.onboarding-step-num {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.onboarding-step-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--gray-800);
}
.onboarding-step-desc {
  font-size: 11px;
  color: var(--gray-600);
  line-height: 1.5;
}
.onboarding-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

/* ═══════════════════════════════════════════════════════════
   인라인 스타일 제거 (2026-09-02) — 하드코딩된 style="..." 정리하며
   새로 추가한 클래스들. 값은 기존 인라인 스타일과 완전히 동일하게 이식.
   (display:none으로 여닫는 동적 토글은 그대로 JS의 .style.display에
   남겨뒀다 — 이 파일 규칙에서 예외로 명시된 "동적 show/hide".)
   ═══════════════════════════════════════════════════════════ */

/* 아이콘 스프라이트 컨테이너 — 항상 숨김(토글 대상 아님, <use>로만 참조) */
.icon-sprite { display: none; }

/* 사이드바 "재고 알림" 메뉴 항목 — 뱃지 오버레이용 relative 앵커 */
.menu-item-alerts { position: relative; }

/* 체크박스 라벨(라벨+체크박스+텍스트 한 줄) — 재고알림 탭에서 반복 사용.
   .form-group label 규칙(명시도 0,1,1)을 이기도록 태그 선택자를 붙임(위와 동일 이유). */
label.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
/* 위 체크박스 라벨 안의 체크박스만 전역 기본(15px)보다 살짝 크게 — 기존 인라인 값 그대로 이식.
   input[type="checkbox"] { width:15px } 전역 규칙(태그+속성 선택자, 명시도 0,1,1)을
   확실히 이기도록 여기도 태그 선택자를 붙임(단순 .checkbox-lg만 쓰면 명시도가 낮아 밀림). */
input.checkbox-lg { width: 16px; height: 16px; }

/* 폼 라벨 옆 필수항목 표시(*) */
.required-mark { color: var(--danger); }

/* 카드/모달 안에서 "제목 + 우측 버튼"을 한 줄에 배치하는 헤더 행 (예약 목록, 재고 부족 상품, 에러 상세 모달) */
.section-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
/* 위 헤더 행 안에서는 .card-title의 기본 margin-bottom이 필요 없음 */
.card-title-flush { margin: 0; }

/* form-group 변형: 라벨 없이 체크박스만 하단/좌측 정렬 */
.form-group-end { display: flex; align-items: flex-end; padding-bottom: 4px; }
.form-group-row { display: flex; align-items: center; }

/* .form-row 변형: 위쪽에 여백 추가 (엑셀 업로드 미리보기의 예약 실행 시각 행) */
.form-row-spaced { margin-top: 16px; }

/* .table-wrapper 변형: 위쪽 여백 추가 (인사이트 탭 안내문 다음 테이블) */
.table-wrapper-spaced { margin-top: 12px; }

/* 업그레이드 모달 상단 안내 영역 */
.upgrade-modal-header { text-align: center; margin-bottom: 20px; }
/* 업그레이드 모달 요금제 3열 그리드 — 모바일에서 1열로 바꾸는 미디어쿼리가
   이 클래스를 직접 타겟팅한다(과거엔 [style*="grid"] 속성 선택자로 인라인
   스타일을 역참조했었음 — 아래 모바일 미디어쿼리 절 참고). */
.upgrade-plan-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 20px; }

/* 모달 안에서 아이콘+텍스트를 한 줄에 붙이는 제목(에러 상세 모달) - .modal h3의
   기본 규칙(태그+클래스 선택자, 명시도 0,1,1)을 이기도록 여기도 태그 선택자를 붙임
   (위 .checkbox-lg와 같은 이유 — 단순 클래스 선택자만 쓰면 명시도가 밀림). */
h3.modal-title-row { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 6px; }
/* 모달 우상단 텍스트형 닫기(✕) 버튼 */
.modal-close-btn { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--gray-500); }
/* 버튼을 컨테이너 폭 전체로 — 모달 하단 확인 버튼 등 */
.btn-full-width { width: 100%; }

/* 사이드바 "쇼핑몰 연결" 버튼(모바일 폼) — 위 .btn-full-width와 조합, margin만 별도 */
#sidebar-btn-connect { margin-top: 6px; }

/* 옵션 적용 결과 박스 / 업로드 확인 필요 행 테이블 — display 토글은 JS가 계속 관리,
   여백만 클래스 대신 ID로 이식(고유 ID가 이미 있어 별도 클래스 불필요) */
#option-apply-result { margin-top: 12px; }
#upload-error-wrapper { margin-top: 12px; }

/* 재고 부족 상품 개수 뱃지 / 마지막 체크 시각 텍스트 */
#alert-low-count { background: var(--danger); color: white; margin-left: 6px; }
#alert-checked-at { font-size: 12px; color: var(--gray-500); }

/* 업그레이드 모달 최대 폭 + 제목/설명 */
#modal-upgrade .modal { max-width: 480px; }
#upgrade-modal-title { margin: 0 0 8px; font-size: 20px; }
#upgrade-modal-desc  { color: var(--gray-600); font-size: 14px; margin: 0; }

/* 에러 상세 모달 최대 폭 + 본문 + 하단 액션 여백 */
#modal-job-error .modal { max-width: 520px; }
#modal-job-error .modal-actions { margin-top: 16px; }
#modal-job-error-body {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 360px;
  overflow-y: auto;
  margin: 0;
}

/* 쇼핑몰 연결 완료 표시 — 사이드바(고정 어두운 표면)용이라 사이드바 로고/메뉴와
   같은 이유로 var(--white) 등 테마 토큰이 아닌 리터럴 값 사용(2026-08-13 패턴과 동일) */
.mall-id-badge.connected { color: #86efac; }

/* 토스트 사라지는 애니메이션 상태 — showToast()의 setTimeout이 클래스만 토글 */
.toast.is-leaving { opacity: 0; transform: translateX(30px); transition: opacity .3s, transform .3s; }

/* 상품 목록 테이블 - 상품명 셀 말줄임 처리 */
.product-name-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

/* 예약 작업 상태 뱃지 - 취소됨 (다른 status-* 뱃지와 달리 리터럴 대신 토큰을 써서
   다크모드가 별도 재정의 없이 자동으로 맞음) */
.status-cancelled { background: var(--gray-200); color: var(--gray-600); }

/* 재고 알림 테이블 - 수량 0(품절)/임계값 이하 색 구분 */
.stock-qty-empty { color: var(--danger); }
.stock-qty-low   { color: var(--warning); }

/* 작업 현황 테이블 - 오류 요약 텍스트 / "자세히" 버튼 / 진행률 % 라벨 */
.job-error-summary   { color: var(--danger); font-size: 12px; }
.job-error-detail-btn {
  border: none; background: none; color: var(--primary); cursor: pointer;
  font-size: 11px; padding: 0 4px; text-decoration: underline;
}
.job-progress-percent { margin-left: 6px; font-size: 12px; color: var(--gray-600); }

/* 목록류 빈 상태 - 에러 메시지로 표시할 때 (.empty-row / .empty-state와 조합) */
.empty-row-error,
.empty-state-error { color: var(--danger); }

/* 옵션 그룹 값 입력 컬럼 (옵션 생성 탭) - option-group-item의 flex 자식 폭 확보 */
.option-group-values-wrap { flex: 1; }
/* 옵션 적용 결과 안내 문구 */
.option-apply-result-text { font-size: 13px; margin-bottom: 8px; color: var(--gray-600); }

/* ═══════════════════════════════════════════════════════════
   아이콘 (2026-09-01, 이모지 아이콘 → SVG 라인아이콘 정리)
   원래 테마토글 버튼(sun/moon)에만 있던 톤(stroke-width 2.2, round
   cap/join, currentColor 상속)을 앱 전체 아이콘으로 확장했다.
   사용법: <svg class="icon"><use href="#icon-xxx"></use></svg>
   ═══════════════════════════════════════════════════════════ */
.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
  flex-shrink: 0;
}
.icon-sm { width: 13px; height: 13px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 34px; height: 34px; stroke-width: 1.6; }

/* 업그레이드 모달 체크리스트의 "미제공" 항목 — 이모지 ✅/✗ 대신 아이콘+회색 처리 */
.upgrade-plan-features .is-unavailable { color: var(--gray-400); }

/* ═══════════════════════════════════════════════════════════
   라이트/다크 테마 토글 버튼 (사이드바 하단)
   ═══════════════════════════════════════════════════════════ */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  margin-bottom: 10px;
  background: #374151;
  border: none;
  border-radius: 6px;
  color: #d1d5db;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}
.theme-toggle-btn:hover { background: #4b5563; }
.theme-toggle-btn svg { flex-shrink: 0; display: block; }
.theme-toggle-label { flex: 1; text-align: left; }

/* ─── 언어 전환 (2026-09-01) — 테마 토글 버튼과 같은 톤/자리 ─────── */
.lang-switch {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  background: #374151;
  border-radius: 6px;
  padding: 3px;
}
.lang-switch-btn {
  flex: 1;
  background: none;
  border: none;
  border-radius: 4px;
  color: #9ca3af;
  font-size: 11px;
  font-family: inherit;
  padding: 6px 4px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.lang-switch-btn:hover { color: #d1d5db; }
.lang-switch-btn.active { background: var(--primary); color: #fff; }

/* 기본값(라이트) - "다크모드로 전환"이라는 의미로 달 아이콘 노출 */
.theme-toggle-icon-sun  { display: none; }
.theme-toggle-icon-moon { display: block; }

/* OS가 다크모드 선호 - 해 아이콘("라이트모드로 전환")으로 교체 */
@media (prefers-color-scheme: dark) {
  .theme-toggle-icon-sun  { display: block; }
  .theme-toggle-icon-moon { display: none; }
}
/* 수동 토글(JS가 data-theme 지정)이 OS 설정보다 항상 우선 */
:root[data-theme="dark"] .theme-toggle-icon-sun   { display: block; }
:root[data-theme="dark"] .theme-toggle-icon-moon  { display: none; }
:root[data-theme="light"] .theme-toggle-icon-sun  { display: none; }
:root[data-theme="light"] .theme-toggle-icon-moon { display: block; }

/* ═══════════════════════════════════════════════════════════
   다크모드
   - prefers-color-scheme: OS가 다크모드면 자동 적용 (기본값 = "시스템 자동")
   - [data-theme]: JS가 사용자의 수동 선택을 localStorage에서 읽어 지정하면
     OS 설정보다 우선 적용된다 (속성 선택자가 명시도가 더 높음).
   ═══════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  :root {
    --primary:    #818cf8;
    --primary-h:  #6366f1;
    --primary-50: #1e1b4b;
    --danger:     #f87171;
    --danger-h:   #ef4444;
    --warning:    #fbbf24;
    --success:    #22c55e;
    --gray-50:    #232c40;
    --gray-100:   #0e1420;
    --gray-200:   #313d54;
    --gray-400:   #64748b;
    --gray-500:   #7e8ba3;
    --gray-600:   #9aa7bd;
    --gray-700:   #c4cede;
    --gray-800:   #eef1f6;
    --white:      #1a2233;
    --shadow:     0 1px 3px rgba(0,0,0,.6), 0 1px 2px rgba(0,0,0,.5);
    --shadow-md:  0 4px 10px rgba(0,0,0,.55), 0 2px 4px rgba(0,0,0,.45);
    color-scheme: dark;
  }

  /* box-shadow는 어두운 배경에서 거의 안 보이므로 테두리로 위계를 보강 */
  .card, .modal { border: 1px solid var(--gray-200); }

  /* 하드코딩된 파스텔 배경 + 진한 텍스트 조합들 - 토큰이 아니라서 자동 반전이 안 됨.
     다크 배경용으로 각각 어두운 틴트 배경 + 밝은 텍스트로 뒤집어 재정의. */
  .status-pending      { background: #33415a; color: #cbd5e1; }
  .status-processing   { background: #1e3a5f; color: #93c5fd; }
  .status-completed    { background: #14532d; color: #86efac; }
  .status-failed       { background: #7f1d1d; color: #fca5a5; }
  .status-partial      { background: #713f12; color: #fde047; }
  .status-rolled-back  { background: #78350f; color: #fdba74; }

  .plan-pro      { background: #1e3a5f; color: #93c5fd; }
  .plan-business { background: #3b2e6e; color: #c4b5fd; }
  .plan-trial    { background: #14532d; color: #86efac; }

  .preview-box {
    background: #453a12;
    border-color: #8a6d1a;
    color: #fde68a;
  }

  .announcement-banner      { color: #c7d2fe; }
  .announcement-close       { color: rgba(199,210,254,.5); }
  .announcement-close:hover { color: #c7d2fe; }

  .trial-banner        { background: #052e1f; color: #86efac; }
  .trial-feature-chip  { background: #0a3d29; border-color: #15803d; color: #86efac; }
  .trial-banner-days   { background: #0a3d29; border-color: #15803d; color: #86efac; }
  .trial-banner-close       { color: rgba(134,239,172,.5); }
  .trial-banner-close:hover { color: #86efac; }
  .trial-email-capture span { color: #86efac; }
  #trial-email-input        { background: #0a3d29; border-color: #15803d; color: #86efac; }
  .trial-email-later        { color: rgba(134,239,172,.6); }
  .trial-email-later:hover  { color: #86efac; }

  .onboarding-card { border-color: #3730a3; }
  .onboarding-step { border-color: #312e6e; }

  .selection-banner,
  .mobile-connect-banner {
    background: #0f2942;
    border-color: #1e40af;
    color: #93c5fd;
  }
  .banner-goto     { color: #60a5fa; }
  .banner-dismiss  { color: rgba(147,197,253,.6); }
  .banner-dismiss:hover { color: #93c5fd; }
  .mcb-close       { color: #93c5fd; }
}

:root[data-theme="dark"] {
  --primary:    #818cf8;
  --primary-h:  #6366f1;
  --primary-50: #1e1b4b;
  --danger:     #f87171;
  --danger-h:   #ef4444;
  --warning:    #fbbf24;
  --success:    #22c55e;
  --gray-50:    #232c40;
  --gray-100:   #0e1420;
  --gray-200:   #313d54;
  --gray-400:   #64748b;
  --gray-500:   #7e8ba3;
  --gray-600:   #9aa7bd;
  --gray-700:   #c4cede;
  --gray-800:   #eef1f6;
  --white:      #1a2233;
  --shadow:     0 1px 3px rgba(0,0,0,.6), 0 1px 2px rgba(0,0,0,.5);
  --shadow-md:  0 4px 10px rgba(0,0,0,.55), 0 2px 4px rgba(0,0,0,.45);
  color-scheme: dark;
}

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .modal { border: 1px solid var(--gray-200); }

:root[data-theme="dark"] .status-pending      { background: #33415a; color: #cbd5e1; }
:root[data-theme="dark"] .status-processing   { background: #1e3a5f; color: #93c5fd; }
:root[data-theme="dark"] .status-completed    { background: #14532d; color: #86efac; }
:root[data-theme="dark"] .status-failed       { background: #7f1d1d; color: #fca5a5; }
:root[data-theme="dark"] .status-partial      { background: #713f12; color: #fde047; }
:root[data-theme="dark"] .status-rolled-back  { background: #78350f; color: #fdba74; }

:root[data-theme="dark"] .plan-pro      { background: #1e3a5f; color: #93c5fd; }
:root[data-theme="dark"] .plan-business { background: #3b2e6e; color: #c4b5fd; }
:root[data-theme="dark"] .plan-trial    { background: #14532d; color: #86efac; }

:root[data-theme="dark"] .preview-box {
  background: #453a12;
  border-color: #8a6d1a;
  color: #fde68a;
}

:root[data-theme="dark"] .announcement-banner      { color: #c7d2fe; }
:root[data-theme="dark"] .announcement-close       { color: rgba(199,210,254,.5); }
:root[data-theme="dark"] .announcement-close:hover { color: #c7d2fe; }

:root[data-theme="dark"] .trial-banner        { background: #052e1f; color: #86efac; }
:root[data-theme="dark"] .trial-feature-chip  { background: #0a3d29; border-color: #15803d; color: #86efac; }
:root[data-theme="dark"] .trial-banner-days   { background: #0a3d29; border-color: #15803d; color: #86efac; }
:root[data-theme="dark"] .trial-banner-close       { color: rgba(134,239,172,.5); }
:root[data-theme="dark"] .trial-banner-close:hover { color: #86efac; }
:root[data-theme="dark"] .trial-email-capture span { color: #86efac; }
:root[data-theme="dark"] #trial-email-input        { background: #0a3d29; border-color: #15803d; color: #86efac; }
:root[data-theme="dark"] .trial-email-later        { color: rgba(134,239,172,.6); }
:root[data-theme="dark"] .trial-email-later:hover  { color: #86efac; }

:root[data-theme="dark"] .onboarding-card { border-color: #3730a3; }
:root[data-theme="dark"] .onboarding-step { border-color: #312e6e; }

:root[data-theme="dark"] .selection-banner,
:root[data-theme="dark"] .mobile-connect-banner {
  background: #0f2942;
  border-color: #1e40af;
  color: #93c5fd;
}
:root[data-theme="dark"] .banner-goto     { color: #60a5fa; }
:root[data-theme="dark"] .banner-dismiss  { color: rgba(147,197,253,.6); }
:root[data-theme="dark"] .banner-dismiss:hover { color: #93c5fd; }
:root[data-theme="dark"] .mcb-close       { color: #93c5fd; }

/* ─── 수동으로 "라이트"를 선택한 경우 - OS가 다크여도 라이트를 강제 ───
   토큰(var())을 쓰는 규칙은 :root[data-theme="light"]에서 토큰을 되돌리면
   자동으로 원복되지만, 위 하드코딩 색상 규칙들은 토큰이 아니라서
   @media(dark)가 계속 이겨버린다 - 그래서 동일한 명시도로 원래 라이트 값을 재선언. */
:root[data-theme="light"] {
  --primary:    #4f46e5;
  --primary-h:  #4338ca;
  --primary-50: #eef2ff;
  --danger:     #ef4444;
  --danger-h:   #dc2626;
  --warning:    #f59e0b;
  --success:    #10b981;
  --gray-50:    #f9fafb;
  --gray-100:   #f3f4f6;
  --gray-200:   #e5e7eb;
  --gray-400:   #9ca3af;
  --gray-500:   #6b7280;
  --gray-600:   #4b5563;
  --gray-700:   #374151;
  --gray-800:   #1f2937;
  --white:      #ffffff;
  --shadow:     0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  color-scheme: light;
}

:root[data-theme="light"] .status-pending      { background: #e5e7eb; color: #374151; }
:root[data-theme="light"] .status-processing   { background: #dbeafe; color: #1d4ed8; }
:root[data-theme="light"] .status-completed    { background: #d1fae5; color: #065f46; }
:root[data-theme="light"] .status-failed       { background: #fee2e2; color: #991b1b; }
:root[data-theme="light"] .status-partial      { background: #fef9c3; color: #854d0e; }
:root[data-theme="light"] .status-rolled-back  { background: #fef3c7; color: #92400e; }

:root[data-theme="light"] .plan-pro      { background: #dbeafe; color: #1d4ed8; }
:root[data-theme="light"] .plan-business { background: #ede9fe; color: #6d28d9; }
:root[data-theme="light"] .plan-trial    { background: #dcfce7; color: #15803d; }

:root[data-theme="light"] .preview-box {
  background: #fef9c3;
  border-color: #fde047;
  color: #78350f;
}

:root[data-theme="light"] .announcement-banner      { color: #1e3a8a; }
:root[data-theme="light"] .announcement-close       { color: rgba(30,58,138,.5); }
:root[data-theme="light"] .announcement-close:hover { color: #1e3a8a; }

:root[data-theme="light"] .trial-banner        { background: #ecfdf5; color: #065f46; }
:root[data-theme="light"] .trial-feature-chip  { background: #ffffff; border-color: #a7f3d0; color: #065f46; }
:root[data-theme="light"] .trial-banner-days   { background: #ffffff; border-color: #a7f3d0; color: #065f46; }
:root[data-theme="light"] .trial-banner-close       { color: rgba(6,95,70,.5); }
:root[data-theme="light"] .trial-banner-close:hover { color: #065f46; }
:root[data-theme="light"] .trial-email-capture span { color: #065f46; }
:root[data-theme="light"] #trial-email-input        { background: #ffffff; border-color: #a7f3d0; color: #065f46; }
:root[data-theme="light"] .trial-email-later        { color: rgba(6,95,70,.6); }
:root[data-theme="light"] .trial-email-later:hover  { color: #065f46; }

:root[data-theme="light"] .onboarding-card { border-color: #c7d2fe; }
:root[data-theme="light"] .onboarding-step { border-color: #dbeafe; }

:root[data-theme="light"] .selection-banner,
:root[data-theme="light"] .mobile-connect-banner {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}
:root[data-theme="light"] .banner-goto     { color: #3b82f6; }
:root[data-theme="light"] .banner-dismiss  { color: #93c5fd; }
:root[data-theme="light"] .banner-dismiss:hover { color: #1e40af; }
:root[data-theme="light"] .mcb-close       { color: #1e40af; }
