/* ============================================================
   산지직셀 디자인 시스템
   ============================================================ */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');

:root {
  /* Primary Green Scale (산지 그린) */
  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;  /* PRIMARY */
  --green-700: #15803d;
  --green-800: #166534;
  --green-900: #14532d;

  /* Warm neutrals */
  --beige-50:  #faf8f3;
  --beige-100: #f5f1e8;
  --wood-500:  #a3825a;

  /* Slate */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Semantic */
  --success: #16a34a;
  --info:    #3b82f6;
  --warning: #f59e0b;
  --danger:  #ef4444;

  /* Primary aliases */
  --primary:        var(--green-600);
  --primary-hover:  var(--green-700);
  --primary-light:  var(--green-100);
  --primary-dark:   var(--green-800);
  --accent:         var(--green-500);

  /* Surfaces */
  --bg:             #ffffff;
  --bg-soft:        var(--slate-50);
  --bg-tinted:      var(--beige-50);
  --surface:        #ffffff;
  --border:         var(--slate-200);
  --border-strong:  var(--slate-300);
  --divider:        var(--slate-100);

  /* Text */
  --text:           var(--slate-900);
  --text-secondary: var(--slate-600);
  --text-muted:     var(--slate-400);

  /* Market brand colors */
  --m-coupang:    #ff5e5e;
  --m-naver:      #03c75a;
  --m-auction:    #ffba00;
  --m-gmarket:    #007aff;
  --m-kakao:      #fee500;
  --m-kakao-text: #000000;
  --m-toss:       #0064ff;
  --m-11st:       #ff0038;

  /* Radii */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 999px;

  /* Shadows */
  --sh-xs:  0 1px 2px rgba(15,23,42,.04);
  --sh-sm:  0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --sh-md:  0 4px 12px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.04);
  --sh-lg:  0 10px 32px rgba(15,23,42,.08), 0 4px 8px rgba(15,23,42,.04);
  --sh-xl:  0 24px 56px rgba(15,23,42,.12);
  --sh-green: 0 4px 14px rgba(22,163,74,.22);

  /* Spacing density */
  --row-h: 44px;
  --header-h: 56px;
  --sidebar-w: 232px;

  /* Type */
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-soft);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Typography scale */
.h1 { font-size: 32px; line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; }
.h2 { font-size: 24px; line-height: 1.3;  font-weight: 700; letter-spacing: -0.015em; }
.h3 { font-size: 20px; line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; }
.h4 { font-size: 16px; line-height: 1.4;  font-weight: 600; }
.body  { font-size: 14px; line-height: 1.55; }
.caption { font-size: 12px; line-height: 1.4; color: var(--text-secondary); }
.tabular { font-variant-numeric: tabular-nums; }

/* ============================================================
   App shell
   ============================================================ */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-header {
  height: var(--header-h);
  background: linear-gradient(180deg, var(--green-700) 0%, var(--green-600) 100%);
  border-bottom: 1px solid var(--green-800);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky; top: 0; z-index: 100;
  color: white;
  box-shadow: 0 1px 0 rgba(0,0,0,.05), 0 4px 14px rgba(22,163,74,.15);
}
.top-header .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
  color: white;
  min-width: var(--sidebar-w);
}
.top-header .brand .logo { width: 28px; height: 28px; }
.top-header .search {
  flex: 1; max-width: 520px;
  position: relative;
  display: flex;
  align-items: center;
  height: 36px;
}
.top-header .search input {
  width: 100%; height: 36px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.14);
  color: white;
  border-radius: var(--r-md);
  padding: 0 12px 0 36px;
  font-family: inherit; font-size: 13px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.top-header .search input::placeholder { color: rgba(255,255,255,.65); }
.top-header .search input:focus {
  border-color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.22);
  box-shadow: 0 0 0 3px rgba(255,255,255,.12);
}
.top-header .search .icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: rgba(255,255,255,.7);
  pointer-events: none;
  width: 16px; height: 16px;
  display: block;
}
.top-header .btn-ghost {
  color: rgba(255,255,255,.85);
}
.top-header .btn-ghost:hover {
  background: rgba(255,255,255,.12);
  color: white;
}
.top-header .right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.role-switcher {
  display: flex; gap: 4px; padding: 3px;
  background: rgba(0,0,0,.18);
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,.12);
}
.role-switcher button {
  appearance: none; border: 0; background: transparent;
  padding: 5px 10px; border-radius: 5px;
  font: 600 12px/1 var(--font); color: rgba(255,255,255,.7);
  cursor: pointer;
}
.role-switcher button.active {
  background: white; color: var(--green-800);
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.role-switcher button:hover:not(.active) { color: white; background: rgba(255,255,255,.08); }

.deposit-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--r-md);
  background: rgba(255,255,255,.16);
  color: white;
  font-size: 12px; font-weight: 600;
  border: 1px solid rgba(255,255,255,.22);
}

.top-header .icon-btn {
  color: rgba(255,255,255,.85);
}
.top-header .icon-btn:hover { background: rgba(255,255,255,.12); color: white; }
.top-header .badge-count {
  border: 1.5px solid var(--green-700);
}

.top-header .header-divider { width: 1px; height: 20px; background: rgba(255,255,255,.22); }
.top-header .header-user-name { color: white; font-weight: 600; }
.top-header .header-user-email { color: rgba(255,255,255,.65); }

.icon-btn {
  appearance: none; border: 0; background: transparent;
  width: 36px; height: 36px; border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary);
  position: relative;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.icon-btn .badge-count {
  position: absolute; top: 4px; right: 4px;
  background: var(--danger); color: white;
  font-size: 9px; font-weight: 700; line-height: 1;
  padding: 2px 4px; border-radius: var(--r-pill);
  min-width: 14px; text-align: center;
}

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green-400), var(--green-600));
  color: white; font-weight: 700; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Body layout */
.app-body { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
}
.sidebar .group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 12px 4px;
}
.sidebar .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--r-md);
  color: var(--text-secondary);
  cursor: pointer; user-select: none;
  font-size: 13px; font-weight: 500;
  position: relative;
}
.sidebar .nav-item:hover { background: var(--bg-soft); color: var(--text); }
.sidebar .nav-item.active {
  background: var(--green-50);
  color: var(--green-800);
  font-weight: 600;
}
.sidebar .nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; background: var(--green-600); border-radius: 2px;
}
.sidebar .nav-item .count {
  margin-left: auto; font-size: 11px;
  background: var(--slate-100); color: var(--text-secondary);
  padding: 1px 6px; border-radius: var(--r-pill);
  font-weight: 600;
}
.sidebar .nav-item.active .count { background: var(--green-100); color: var(--green-800); }

.sidebar .supplier-pill {
  padding: 10px 12px;
  background: var(--beige-100); border-radius: var(--r-md);
  margin-bottom: 12px;
}
.sidebar .supplier-pill .label { font-size: 10.5px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.sidebar .supplier-pill .name { font-size: 14px; font-weight: 700; margin-top: 2px; display: flex; align-items: center; gap: 6px; }

.sidebar .footer {
  margin-top: auto; padding: 12px;
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-muted);
}
.sidebar .footer .csbox { display: flex; gap: 6px; margin-top: 8px; }

.main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  padding: 24px 28px 60px;
  gap: 20px;
}

.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-header .titles { display: flex; flex-direction: column; gap: 4px; }
.page-header .crumbs { font-size: 12px; color: var(--text-muted); }
.page-header .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  appearance: none; border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: var(--r-md);
  font: 600 13px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn .icon { width: 14px; height: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--green-600); color: white; box-shadow: var(--sh-green); }
.btn-primary:hover:not(:disabled) { background: var(--green-700); }
.btn-secondary { background: var(--green-50); color: var(--green-800); border-color: var(--green-200); }
.btn-secondary:hover:not(:disabled) { background: var(--green-100); border-color: var(--green-300); }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { background: var(--bg-soft); border-color: var(--slate-400); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-soft); color: var(--text); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #fecaca; }
.btn-danger:hover:not(:disabled) { background: #fef2f2; border-color: #fca5a5; }
.btn-danger-solid { background: var(--danger); color: white; }
.btn-danger-solid:hover:not(:disabled) { background: #dc2626; }
.btn-warning { background: var(--surface); color: var(--warning); border-color: #fed7aa; }
.btn-warning:hover:not(:disabled) { background: #fff7ed; border-color: #fdba74; }
.btn-info { background: var(--surface); color: var(--info); border-color: #bfdbfe; }
.btn-info:hover:not(:disabled) { background: #eff6ff; border-color: #93c5fd; }
.btn-purple { background: var(--surface); color: #7c3aed; border-color: #ddd6fe; }
.btn-purple:hover:not(:disabled) { background: #f5f3ff; border-color: #c4b5fd; }
.btn-teal { background: var(--surface); color: #0d9488; border-color: #99f6e4; }
.btn-teal:hover:not(:disabled) { background: #f0fdfa; }
.btn-dark { background: var(--slate-800); color: white; }
.btn-dark:hover:not(:disabled) { background: var(--slate-900); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 11px; border-radius: var(--r-sm); }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14px; }

/* ============================================================
   Form fields
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.field-label .req { color: var(--danger); margin-left: 2px; }

.input, .select, .textarea {
  appearance: none;
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font: 13px/1 var(--font);
  color: var(--text);
  outline: none;
  transition: border-color .12s, box-shadow .12s, background .12s;
  width: 100%;
}
.textarea { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; min-height: 80px; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px var(--green-100);
}
.input[disabled] { background: var(--bg-soft); color: var(--text-muted); }

.select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'><path d='M3 4.5 6 7.5 9 4.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 30px;
}

.checkbox, .radio {
  appearance: none;
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .1s;
}
.radio { border-radius: 50%; }
.checkbox:checked, .radio:checked { background: var(--green-600); border-color: var(--green-600); }
.checkbox:checked::after {
  content: ''; width: 10px; height: 10px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'><path d='m3 8 3.5 3.5L13 5' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat;
}
.radio:checked::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: white; }

.switch {
  appearance: none; cursor: pointer;
  width: 32px; height: 18px;
  background: var(--slate-300);
  border-radius: var(--r-pill);
  position: relative;
  transition: background .15s;
  flex-shrink: 0;
}
.switch::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: white; border-radius: 50%;
  transition: transform .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch:checked { background: var(--green-600); }
.switch:checked::after { transform: translateX(14px); }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
}
.card-pad { padding: 20px; }
.card-pad-sm { padding: 14px; }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
  overflow: hidden;
}
.kpi-card .label { font-size: 12.5px; color: var(--text-secondary); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-card .value { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-card .delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; }
.kpi-card .delta.up { color: var(--green-700); }
.kpi-card .delta.down { color: var(--danger); }
.kpi-card .accent {
  position: absolute; right: -8px; top: -8px;
  width: 56px; height: 56px; border-radius: 50%;
  opacity: .12;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
  line-height: 1.6;
}
.badge-square { border-radius: var(--r-sm); }
.badge-lg { padding: 4px 10px; font-size: 12px; }

.badge-green   { background: var(--green-100); color: var(--green-800); }
.badge-blue    { background: #dbeafe; color: #1e40af; }
.badge-yellow  { background: #fef3c7; color: #92400e; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-gray    { background: var(--slate-100); color: var(--slate-700); }
.badge-orange  { background: #fed7aa; color: #9a3412; }
.badge-purple  { background: #ede9fe; color: #5b21b6; }
.badge-pink    { background: #fce7f3; color: #9d174d; }
.badge-teal    { background: #ccfbf1; color: #115e59; }
.badge-beige   { background: var(--beige-100); color: var(--wood-500); }

/* Status corner badges on cards */
.corner-badge {
  display: inline-flex; align-items: center;
  padding: 3px 7px; border-radius: var(--r-sm);
  font-size: 10.5px; font-weight: 700;
  letter-spacing: -0.01em;
}

/* Market badges */
.market-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: var(--r-sm);
  font-size: 10.5px; font-weight: 700;
  color: white;
  letter-spacing: -0.01em;
}
.market-coupang { background: var(--m-coupang); }
.market-naver   { background: var(--m-naver); }
.market-auction { background: var(--m-auction); color: #5b3a00; }
.market-gmarket { background: var(--m-gmarket); }
.market-kakao   { background: var(--m-kakao); color: var(--m-kakao-text); }
.market-toss    { background: var(--m-toss); }
.market-11st    { background: var(--m-11st); }

/* Market chip (status indicator) */
.market-chip {
  width: 22px; height: 22px;
  border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: white;
  position: relative;
  cursor: default;
  letter-spacing: -0.02em;
}
.market-chip[data-state="none"] { opacity: .3; background: var(--slate-300) !important; color: var(--slate-600) !important; }
.market-chip[data-state="waiting"] { box-shadow: 0 0 0 2px #fef3c7; }
.market-chip[data-state="done"] { box-shadow: 0 0 0 2px var(--green-100); }
.market-chip[data-state="error"] { box-shadow: 0 0 0 2px #fee2e2; }
.market-chip[data-state="error"]::after {
  content: ''; position: absolute; right: -2px; top: -2px;
  width: 8px; height: 8px; background: var(--danger); border-radius: 50%;
  border: 1.5px solid white;
}

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  font: 500 13px/1 var(--font);
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--green-700); border-bottom-color: var(--green-600); font-weight: 600; }
.tab .tab-count {
  background: var(--slate-100); color: var(--text-secondary);
  padding: 1px 6px; border-radius: var(--r-pill);
  font-size: 10.5px; font-weight: 700;
}
.tab.active .tab-count { background: var(--green-100); color: var(--green-800); }

.pill-tabs {
  display: inline-flex; gap: 4px; padding: 3px;
  background: var(--bg-soft); border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.pill-tabs button {
  appearance: none; border: 0; background: transparent;
  padding: 6px 12px; border-radius: 5px;
  font: 500 12px/1 var(--font); color: var(--text-secondary);
  cursor: pointer;
}
.pill-tabs button.active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--sh-xs); font-weight: 600;
}

/* ============================================================
   Data Grid
   ============================================================ */
.dg-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.dg-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  flex-wrap: wrap;
}
.dg-toolbar .left { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex: 1; }
.dg-toolbar .right { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.dg-status { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.dg-status strong { color: var(--text); font-weight: 700; }

.dg-scroll {
  overflow-x: auto;
  width: 100%;
}
.dg-scroll::-webkit-scrollbar { height: 10px; }
.dg-scroll::-webkit-scrollbar-track { background: var(--bg-soft); }
.dg-scroll::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 5px; }

table.dg {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
table.dg thead th {
  background: var(--bg-soft);
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  position: sticky; top: 0;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
}
table.dg thead th:hover { background: var(--slate-100); color: var(--text); }
table.dg thead th.sort-active { color: var(--green-700); background: var(--green-50); }
table.dg thead th .sort-arrow {
  display: inline-block; margin-left: 3px;
  font-size: 9px;
  opacity: .9;
}
table.dg thead th.sticky-l { position: sticky; left: 0; z-index: 2; }
table.dg thead th.sticky-l-2 { position: sticky; left: 36px; z-index: 2; }

table.dg tbody td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
  background: var(--surface);
  white-space: nowrap;
}
table.dg tbody tr:hover td { background: var(--bg-soft); }
/* 선택 행 — 매우 옅은 배경 + 좌측 강조선만 (PPT/Notion 스타일).
   여러 행 선택 시 화면 전체가 초록색으로 압도되는 어색함 해소. */
table.dg tbody tr.selected td { background: rgba(34, 197, 94, 0.05); }
table.dg tbody tr.selected td:first-child {
  box-shadow: inset 3px 0 0 var(--green-600);
}
table.dg tbody td.sticky-l { position: sticky; left: 0; z-index: 1; }
table.dg tbody td.sticky-l-2 { position: sticky; left: 36px; z-index: 1; }
table.dg tbody td .thumb {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: white;
}

.dg-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.dg-pagination {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--divider);
}
.dg-pagination .info { font-size: 12px; color: var(--text-secondary); margin-right: auto; }
.dg-pagination .pages { display: flex; gap: 2px; }
.dg-pagination .pages button {
  appearance: none; border: 1px solid var(--border);
  background: var(--surface);
  min-width: 28px; height: 28px; padding: 0 8px;
  border-radius: var(--r-sm);
  font: 600 12px/1 var(--font);
  color: var(--text-secondary);
  cursor: pointer;
}
.dg-pagination .pages button:hover { background: var(--bg-soft); color: var(--text); }
.dg-pagination .pages button.active { background: var(--green-600); border-color: var(--green-600); color: white; }

/* ============================================================
   Modals + slide panels
   ============================================================ */
.scrim {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: scrim-in .15s ease-out;
}
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  display: flex; flex-direction: column;
  animation: modal-in .2s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.modal-header .title { font-size: 16px; font-weight: 700; flex: 1; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

.slide-panel {
  position: fixed; right: 0; top: 0;
  height: 100vh;
  width: min(540px, 100vw);
  background: var(--surface);
  box-shadow: var(--sh-xl);
  z-index: 1001;
  display: flex; flex-direction: column;
  animation: slide-in .25s cubic-bezier(.16,1,.3,1);
}
@keyframes slide-in { from { transform: translateX(100%); } to { transform: none; } }
.slide-panel .ph {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.slide-panel .pb { flex: 1; overflow-y: auto; padding: 20px; }
.slide-panel .pf {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px;
  background: var(--bg-soft);
}

/* ============================================================
   Filter bar / search bar
   ============================================================ */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.filter-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.filter-row .input, .filter-row .select { width: auto; min-width: 140px; }
.filter-row .input.long { min-width: 240px; flex: 1; }
.quick-chip {
  appearance: none; border: 1px solid var(--border);
  background: var(--surface);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font: 500 12px/1 var(--font); color: var(--text-secondary);
  cursor: pointer;
}
.quick-chip:hover { background: var(--bg-soft); color: var(--text); }
.quick-chip.active { background: var(--green-600); border-color: var(--green-600); color: white; }

/* ============================================================
   Product card (catalog)
   ============================================================ */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  cursor: pointer;
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
  border-color: var(--green-200);
}
.product-card .thumb {
  width: 100%; aspect-ratio: 1;
  position: relative;
  overflow: hidden;
}
.product-card .thumb .corner-tl { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; flex-wrap: wrap; max-width: 80%; }
.product-card .thumb .corner-bl { position: absolute; bottom: 8px; left: 8px; }
.product-card .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-card .name { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--text); }
.product-card .meta { font-size: 11.5px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.product-card .price-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 6px; }
.product-card .price { font-size: 16px; font-weight: 700; color: var(--text); }
.product-card .price .unit { font-size: 11px; font-weight: 500; color: var(--text-muted); margin-left: 2px; }
.product-card .stock { font-size: 11px; color: var(--text-secondary); }
.product-card .cta-row { display: flex; gap: 6px; margin-top: 10px; }

/* Photo placeholder gradients - based on category */
.ph-fruit  { background: linear-gradient(135deg, #fecaca 0%, #fb923c 50%, #fbbf24 100%); }
.ph-veg    { background: linear-gradient(135deg, #bbf7d0 0%, #4ade80 50%, #22c55e 100%); }
.ph-fish   { background: linear-gradient(135deg, #bfdbfe 0%, #60a5fa 50%, #1e40af 100%); }
.ph-meat   { background: linear-gradient(135deg, #fecaca 0%, #f87171 50%, #b91c1c 100%); }
.ph-grain  { background: linear-gradient(135deg, #fef3c7 0%, #fbbf24 50%, #a3825a 100%); }
.ph-proc   { background: linear-gradient(135deg, #e7e5e4 0%, #a8a29e 50%, #57534e 100%); }
.ph-dairy  { background: linear-gradient(135deg, #fef9c3 0%, #fde68a 50%, #f5f1e8 100%); }

.ph-label {
  position: absolute; bottom: 8px; right: 10px;
  color: rgba(255,255,255,.9);
  font-size: 11px; font-weight: 700; letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
}

/* ============================================================
   Charts (simple SVG)
   ============================================================ */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
}
.chart-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.chart-title .t { font-size: 14px; font-weight: 700; }

/* ============================================================
   Catalog header / categories
   ============================================================ */
.cat-tabs {
  display: flex; gap: 4px; padding: 6px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tabs .cat-tab {
  appearance: none; border: 0; background: transparent;
  padding: 8px 16px;
  font: 500 13.5px/1 var(--font);
  color: var(--text-secondary);
  cursor: pointer; white-space: nowrap;
  border-radius: var(--r-pill);
}
.cat-tabs .cat-tab.active { background: var(--green-600); color: white; font-weight: 600; }
.cat-tabs .cat-tab:hover:not(.active) { background: var(--bg-soft); color: var(--text); }

/* Toast */
.toast-stack {
  position: fixed; right: 20px; top: 76px;
  z-index: 5000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--slate-900);
  color: white;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--sh-lg);
  display: flex; align-items: center; gap: 10px;
  min-width: 260px;
  animation: toast-in .2s ease-out;
}
.toast.success { border-left: 3px solid var(--green-500); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* Misc helpers */
.row { display: flex; gap: 8px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 8px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-12 { gap: 12px; }
.gap-6 { gap: 6px; }
.gap-4 { gap: 4px; }
.flex-1 { flex: 1; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mr-auto { margin-right: auto; }
.ml-auto { margin-left: auto; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--green-700); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-7 { font-weight: 700; }
.fw-6 { font-weight: 600; }
.fw-5 { font-weight: 500; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; }
.fs-20 { font-size: 20px; }
.tnums { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.right { text-align: right; }
.divider-h { height: 1px; background: var(--divider); margin: 16px 0; }

/* Grid columns helper */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }
.grid-7 { grid-template-columns: repeat(7, 1fr); }

/* Auth page */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr auto;
  background: var(--bg-soft);
}
.auth-visual {
  background: linear-gradient(180deg, var(--green-700) 0%, var(--green-800) 60%, var(--green-900) 100%);
  position: relative; overflow: hidden;
  color: white;
  display: flex; flex-direction: column;
  padding: 48px;
  justify-content: space-between;
}
.auth-visual::before, .auth-visual::after {
  content: ''; position: absolute;
  border-radius: 50%; opacity: .15;
}
.auth-visual::before { background: var(--green-300); width: 480px; height: 480px; top: -160px; right: -200px; }
.auth-visual::after { background: var(--green-400); width: 280px; height: 280px; bottom: -80px; left: -100px; }
.auth-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 36px 36px;
  box-shadow: var(--sh-md);
  border: 1px solid var(--border);
}

/* Logo svg styling */
.logo-leaf {
  display: inline-block;
  width: 28px; height: 28px;
}

/* Hide scrollbars in horizontal scroll regions */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { scrollbar-width: none; }

/* Print-style numeric stat */
.stat-line {
  display: flex; align-items: baseline; gap: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-line .big { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.stat-line .unit { color: var(--text-muted); font-size: 12px; }

/* Section header */
.section-h {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-h .t { font-size: 16px; font-weight: 700; }
.section-h .a { font-size: 12px; color: var(--text-secondary); }

/* Pretty scroll for catalog left panel */
.flt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  display: flex; flex-direction: column; gap: 14px;
}
.flt-group { display: flex; flex-direction: column; gap: 6px; }
.flt-group .h { font-size: 12px; font-weight: 700; color: var(--text); }
.flt-group .opt { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-secondary); padding: 2px 0; }
.flt-group .opt .count { margin-left: auto; font-size: 11px; color: var(--text-muted); }

/* Quill 에디터 HTML 렌더 — 카탈로그 상세·미리보기·셀러 상하단 모두 공통.
   네이버 스마트스토어(860) / 쿠팡(780) 표준 폭 기준 반응형. */
.ql-editor img {
  max-width: 100% !important;
  height: auto !important;
  display: block;
  margin: 8px auto;
}
.ql-editor video,
.ql-editor iframe {
  max-width: 100%;
}
