:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #ECEEF1;
  --ink: #1B1E24;
  --ink-muted: #5B6270;
  --border: #D8DBE1;
  --accent: #35507D;
  --accent-ink: #FFFFFF;
  --danger: #A6403F;
  --danger-soft: #F5E2E1;
  --success: #2F9E44;
  --success-soft: #E1F0E6;
  --warn-bg: #FEF3C7;
  --warn-ink: #8A5A0A;
  --info-tint: #EEF2FF;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161A;
    --surface: #1B1E24;
    --surface-2: #22262D;
    --ink: #E7E8E6;
    --ink-muted: #9BA2AF;
    --border: #2B2F37;
    --accent: #86A4D9;
    --accent-ink: #0F1420;
    --danger: #D98785;
    --danger-soft: #3A2222;
    --success: #4CB05F;
    --success-soft: #1F3326;
    --warn-bg: #4A3B14;
    --warn-ink: #F5CE7A;
    --info-tint: #232A42;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); }
h1 { font-size: 1.4rem; font-weight: 800; margin: 0 0 .2rem; }
h2 { font-size: 1.1rem; font-weight: 700; margin: 0 0 1rem; }
code { font-family: var(--mono); background: var(--surface-2); padding: .1em .35em; border-radius: 4px; font-size: .85em; }
a { color: var(--accent); text-decoration: none; }

.app-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1.4rem 1rem;
}
.sidebar .brand { font-weight: 800; font-size: 1.05rem; margin-bottom: 1.6rem; }
.sidebar nav { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.sidebar nav a { color: var(--ink-muted); padding: .55rem .7rem; border-radius: 8px; font-size: .92rem; }
.sidebar nav a.active, .sidebar nav a:hover { background: var(--surface-2); color: var(--ink); }
.sidebar nav a.nav-sub-link { padding-left: 1.4rem; font-size: .86rem; }
.nav-group-label {
  font-size: .74rem; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .04em;
  padding: .5rem .7rem .2rem; margin-top: .5rem;
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: none; font-family: inherit; cursor: pointer; text-align: left;
}
.nav-group:first-child .nav-group-label { margin-top: 0; }
.nav-group-label:hover { color: var(--ink); }
.nav-group-caret { font-size: .68rem; transition: transform .15s ease; }
.nav-group-links { display: flex; flex-direction: column; gap: .2rem; overflow: hidden; }
.nav-group.nav-group-collapsed .nav-group-links { display: none; }
.nav-group.nav-group-collapsed .nav-group-caret { transform: rotate(-90deg); }
.sidebar-footer { font-size: .82rem; color: var(--ink-muted); border-top: 1px solid var(--border); padding-top: .8rem; }
.sidebar-footer .whoami { margin-bottom: .4rem; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font-size: .82rem; }

.content { padding: 2rem 2.4rem; min-width: 0; }
.page-head { margin-bottom: 1.4rem; }
.page-head .sub { color: var(--ink-muted); font-size: .9rem; max-width: 46rem; }

.toolbar {
  display: flex; align-items: center; gap: .6rem; margin: .8rem -2.4rem 0; padding: .8rem 2.4rem;
  position: sticky; top: 0; z-index: 25; background: var(--bg); border-bottom: 1px solid var(--border);
}
.toolbar .spacer { flex: 1; }
/* A second .toolbar further down a page (e.g. catalog's 판매상품 filter row) can't also
   be position:sticky at top:0 — both would pin to the exact same spot and the later one
   in DOM order would render on top of the first, hiding its buttons while scrolling. */
.toolbar.subtoolbar { position: static; margin-top: 0; }

.sales-product-panel { margin: 1rem -2.4rem 0; padding: .8rem 2.4rem; border-bottom: 1px solid var(--border); }
.sales-product-panel-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.sales-product-panel-head h3 { font-size: .95rem; margin: 0; margin-right: .4rem; }
/* 모델명(한글) 선택 -> 판매상품 선택, 나란히(오른쪽) 배치되는 2단계 드롭다운. */
#modelGroupSelect, #salesProductSelect { min-width: 260px; max-width: 360px; }

.inline-row { display: flex; align-items: center; gap: .4rem; }

.empty-state { padding: 3rem 2.4rem; color: var(--ink-muted); text-align: center; }

.representative-summary {
  display: flex; flex-wrap: wrap; gap: 1.2rem; margin: 0 -2.4rem 1rem; padding: .8rem 2.4rem;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.representative-summary .rep-item { display: flex; flex-direction: column; gap: .15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.representative-summary .rep-item label { font-weight: 400; font-size: .78rem; color: var(--ink-muted); }
.representative-summary .rep-empty { color: var(--ink-muted); font-size: .88rem; }

.search-connect-wrap { position: relative; flex: 1; max-width: 420px; }
.search-connect-wrap input { width: 100%; }
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30; max-height: 260px; overflow-y: auto; overflow-x: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.search-result-item {
  display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border);
  padding: .5rem .7rem; font-weight: 400; font-size: .85rem; color: var(--ink); border-radius: 0;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface-2); }
.search-result-item strong { font-variant-numeric: tabular-nums; margin-right: .4rem; }
.search-result-line { color: var(--ink-muted); font-size: .78rem; margin-left: .4rem; }
.search-result-empty { padding: .6rem .7rem; color: var(--ink-muted); font-size: .85rem; }
/* 상품관리 - 단품 검색해서 연결: 추가한 항목은 목록에서 지우거나 검색창을 비우지 않고
   그 자리에서 "추가됨"으로 바꿔서 계속 표시 — 같은 검색결과에서 여러 단품을 연달아
   눌러 한 번에 추가하기 위함. */
.search-result-item:disabled { cursor: default; }
.search-result-item.search-result-added { background: var(--success-soft); color: var(--ink-muted); }
.search-result-added-badge { color: var(--success); font-weight: 600; font-size: .78rem; margin-left: .5rem; }
/* 프로모션의 "적용상품 검색" 결과 — 한 번에 여러 상품을 체크해서 일괄 연결할 수 있게
   기존 .search-result-item(단일클릭 즉시연결) 대신 체크박스 행 + 하단 고정 추가 버튼을 씀. */
.modal-inner .search-result-checkable {
  display: flex; flex-direction: row; align-items: center; gap: .5rem; padding: .5rem .7rem; font-size: .85rem;
  border-bottom: 1px solid var(--border); cursor: pointer; white-space: nowrap;
}
.search-result-checkable:hover { background: var(--surface-2); }
.search-results-actions {
  display: flex; justify-content: flex-end; padding: .5rem .7rem; position: sticky; bottom: 0;
  background: var(--surface); border-top: 1px solid var(--border);
}

.disclosure-panel { margin: 0 -2.4rem 1rem; padding: .8rem 2.4rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.disclosure-table { border-collapse: collapse; width: 100%; max-width: 900px; }
.disclosure-table th { text-align: left; font-weight: 400; color: var(--ink-muted); font-size: .82rem; padding: .3rem .8rem .3rem 0; white-space: nowrap; vertical-align: top; }
.disclosure-table td { padding: .2rem 0; }
.disclosure-table td input { width: 100%; font-size: .84rem; padding: .25rem .4rem; border: 1px solid transparent; border-radius: 4px; background: none; }
.disclosure-table td input:hover, .disclosure-table td input:focus { border-color: var(--border); background: var(--surface); }

tr.representative-row { background: var(--surface-2); font-weight: 700; }
/* .warn-cell는 <td>뿐 아니라 <span>(마진 경고 등, 표 밖에서도 씀)에도 쓰여서
   .grid-table td로 한정하지 않고 클래스 단독으로 배경/글자색을 준다 — 인라인
   span에도 자연스럽게 적용됨. */
.warn-cell { background: var(--warn-bg); color: var(--warn-ink); }
.warn-icon { color: var(--warn-ink); }

button {
  font-family: var(--font); font-size: .88rem; font-weight: 600; padding: .5rem 1rem;
  border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  cursor: pointer;
}
button.btn-ghost { background: none; color: var(--ink); border-color: var(--border); }
button.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }
button.btn-success { background: var(--success); border-color: var(--success); color: white; }
button:disabled { opacity: .5; cursor: not-allowed; }
/* .btn-ghost on non-<button> tags (toolbar download link, upload label) — same look as
   button.btn-ghost above, since the plain `button {...}` reset doesn't apply to them. */
a.btn-ghost, label.btn-ghost {
  display: inline-flex; align-items: center; font-family: var(--font); font-size: .88rem;
  font-weight: 600; padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--border);
  background: none; color: var(--ink); cursor: pointer; text-decoration: none;
}
a.btn-ghost:hover, label.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

select, input[type="text"], input[type="number"], input[type="password"], textarea {
  font-family: var(--font); font-size: .88rem; padding: .5rem .6rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
}
textarea { font-family: var(--mono); width: 100%; }
.search-input { min-width: 220px; }
/* 크롬이 이 페이지 origin에 저장된 로그인 아이디("admin")를 검색창에 자동으로 채워
   넣는 문제 대응 — autocomplete="off"만으로는 크롬이 무시하는 경우가 많아서, 자동채움이
   실제로 발생하는 순간(:-webkit-autofill 진입)을 이 무해한 애니메이션으로 감지해
   JS에서 즉시 비운다(app.js/components.js의 animationstart 리스너와 짝을 이룸).
   페이지 로드 직후뿐 아니라 나중에 다시 채워 넣힐 때도 매번 잡아낸다. */
@keyframes onAutoFillStart { from {} to {} }
.search-input:-webkit-autofill { animation-name: onAutoFillStart; animation-duration: 1ms; }

.table-scroll { overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
table.grid-table { border-collapse: collapse; table-layout: fixed; font-size: .86rem; }
.grid-table th, .grid-table td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: .5rem .7rem; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; }
.grid-table th:last-child, .grid-table td:last-child { border-right: none; }
/* Thick right border to visually separate one group of columns from the next (e.g.
   competitor 1's fields from competitor 2's) — set per-column via the edit panel. */
.grid-table th.divider-after, .grid-table td.divider-after { border-right: 3px solid var(--ink); }
/* 틀고정(frozen columns) — app.js/catalog.js set position:sticky + left inline (the left
   offset depends on the actual pixel widths of preceding columns, which only JS knows at
   render time); this just supplies the opaque backdrop so the frozen cell fully occludes
   whatever scrolls underneath it, plus a shadow on the boundary column so the frozen edge
   reads as a visible seam instead of just silently not scrolling. */
.grid-table td.frozen-col { background: var(--surface); z-index: 3; }
.grid-table th.frozen-col { z-index: 8; }
#pricingGroupRow th.frozen-col { z-index: 9; }

/* 계정관리(accounts.js) — 아이디/비밀번호 칸 클릭 시 클립보드 복사 */
.acct-copy-cell { cursor: pointer; }
.acct-copy-cell:hover { background: var(--surface-2); text-decoration: underline dotted; }
.acct-memo-cell { white-space: normal; overflow-wrap: anywhere; }
.acct-copy-toast {
  position: fixed; z-index: 200; pointer-events: none;
  background: var(--ink); color: var(--bg); font-size: .78rem; font-weight: 600;
  padding: .2rem .5rem; border-radius: 6px; box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.acct-filter-bar { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.acct-filter-btn {
  font-family: var(--font); font-size: .8rem; font-weight: 600; padding: .35rem .8rem;
  border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface);
  color: var(--ink); cursor: pointer;
}
.acct-filter-btn:hover { filter: brightness(0.97); }
.acct-filter-btn.active { border-style: solid; }

/* 단품관리 - 모델명 일괄수정 팝업 (app.js openBulkModelModal 등) */
.bulk-model-apply-form {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: .8rem 1rem; flex-shrink: 0;
}
.bulk-model-apply-form h3 { margin: 0 0 .2rem; font-size: .92rem; }
.bulk-model-apply-form .sub { margin: 0 0 .5rem; }
#bulkFieldValueWrap input, #bulkFieldValueWrap select { min-width: 220px; }
#bulkModelTable td.editable { cursor: text; }
.frozen-col.frozen-edge { box-shadow: 3px 0 6px -2px rgba(0, 0, 0, .35); }
.grid-table thead th {
  background: var(--surface-2); font-weight: 700; position: sticky; top: 0; z-index: 5;
  white-space: normal; vertical-align: top;
}
/* Pricing grid's header row sits below #pricingGroupRow (a second sticky row, 26px tall,
   pinned at top:0) — offset by that same 26px so the two rows stack without overlapping.
   Pages with a single-row thead (e.g. 신상품관리 목록) keep the base top:0 above and don't
   need this, so it's scoped to the pricing grid's specific row id rather than the shared
   .grid-table class — applying top:26px there unconditionally pushed a plain header down
   into the first body row of any other table reusing grid-table. */
#pricingHeadRow th { top: 26px; }
.grid-table thead th.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
/* Row of small buttons sitting above the header row — one per expanded group, over its
   frontmost column, to collapse it. Stacked sticky on top of the header row below it via
   a matching fixed height (26px) so the two rows don't overlap while both stay pinned. */
#pricingGroupRow th {
  position: sticky; top: 0; z-index: 6; height: 26px; padding: 0;
  background: var(--surface-2);
}
.group-row-btn {
  width: 100%; height: 100%; border: none; background: none; cursor: pointer;
  font-size: .7rem; font-weight: 600; color: var(--ink-muted); text-align: left;
  padding: 0 .5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.group-row-btn::before { content: "▾ "; }
.group-row-collapsed-icon {
  width: 100%; height: 100%; border: none; background: none; cursor: pointer;
  font-size: .7rem; color: var(--ink-muted); display: flex; align-items: center; justify-content: center;
}
.group-row-collapsed-icon:hover { color: var(--accent); }
.group-row-btn:hover { color: var(--accent); background: var(--surface); }
.grid-table thead th .th-label { display: block; cursor: grab; padding-right: 8px; }
/* Column names wrap up to 2 lines instead of truncating with an ellipsis on one line —
   long names no longer force the column wider than its data actually needs. */
.grid-table thead th .label-text {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; text-overflow: ellipsis; white-space: normal; line-height: 1.25;
}
.grid-table thead th .group-label {
  display: flex; align-items: center; gap: 4px; font-size: .68rem; color: var(--ink-muted);
  font-weight: 500; margin-top: 2px; min-width: 0;
}
.grid-table thead th .group-desc-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.grid-table thead th .col-resizer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 16px; cursor: col-resize; z-index: 2;
  border-right: 2px solid var(--border);
}
.grid-table thead th .col-resizer:hover, .grid-table thead th .col-resizer:active { border-right-color: var(--accent); border-right-width: 3px; }

/* 광고분석 캠페인 목록의 "⚙ 칼럼" 표시/순서 설정 팝오버 — .master-add-row 안에서
   position:relative 없이도 뜨도록 버튼을 감싼 wrapper 자체를 기준점으로 잡는다. */
.col-settings { position: relative; display: inline-block; }
.col-settings-panel {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 4px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15); padding: .4rem; min-width: 220px; max-height: 320px; overflow-y: auto;
}
.col-panel-header {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  font-size: .78rem; color: var(--ink-muted); padding: .2rem .3rem .5rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem;
}
.col-panel-header .col-panel-reset { background: none; border: none; color: var(--accent); cursor: pointer; font-size: .78rem; padding: 0; }
.col-panel-item {
  display: flex; align-items: center; gap: .4rem; padding: .3rem; border-radius: 6px; cursor: default;
}
.col-panel-item:hover { background: var(--surface-2); }
.col-panel-item.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-panel-item .col-drag-handle { cursor: grab; color: var(--ink-muted); }
.col-panel-item label { display: flex; align-items: center; gap: .4rem; font-size: .86rem; cursor: pointer; }

/* 광고분석 캠페인 행 클릭 시 나타나는 일자별 추이 차트 컨테이너 — Chart.js는 부모가
   명시적 높이를 가져야 정상 렌더링됨(maintainAspectRatio:false와 짝을 맞춰서 씀). */
.chart-wrap { position: relative; height: 260px; margin-bottom: 1rem; }
.chart-wrap canvas { display: block; }
.grid-table tr.clickable-row { cursor: pointer; }
.grid-table tr.clickable-row:hover { background: var(--surface-2); }
.grid-table tr.clickable-row.selected { background: var(--surface-2); outline: 2px solid var(--accent); outline-offset: -2px; }

/* Collapsed column group: the whole group shrinks to one narrow vertical-text tab that
   sits where the group used to be — click it to expand back into individual columns.
   `height: 100%` on the button was tried first but table cells can resolve percentage
   heights against a cell whose own height depends on that same child in some browsers,
   which blew the header row up to ~1000px — so this sizes from content instead. */
.grid-table thead th.group-chip { padding: 0; vertical-align: middle; }
.group-chip-btn {
  width: 100%; border: none; background: none; cursor: pointer;
  writing-mode: vertical-rl; text-orientation: mixed; font-size: .74rem; font-weight: 600;
  color: var(--ink-muted); padding: .6rem 0; display: block; margin: 0 auto;
}
.group-chip-btn:hover { color: var(--accent); background: var(--surface); }
.grid-table td.group-collapsed-cell { background: var(--surface-2); padding: 0; }
.grid-table td.computed { background: var(--surface-2); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.grid-table td.editable { cursor: text; }
.grid-table td.copyable-cell { cursor: pointer; }
.grid-table td.copyable-cell:hover { background: var(--info-tint); }
.grid-table td input, .grid-table td select { border: none; background: none; padding: 0; width: 100%; font-size: .86rem; color: var(--ink); }
.grid-table td.error-cell { color: var(--danger); }
.grid-table td, .grid-table th { font-variant-numeric: tabular-nums; }

.color-row { display: flex; align-items: center; gap: .6rem; }
input[type="color"] { width: 44px; height: 32px; padding: 2px; cursor: pointer; }
.color-palette { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.color-swatch {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); cursor: pointer; padding: 0;
}
.color-swatch.selected { outline: 2px solid var(--accent); outline-offset: 2px; }

/* image cells */
.grid-table td.image-cell { padding: .3rem .5rem; }
.image-cell-inner { position: relative; width: 48px; height: 48px; }
.cell-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; cursor: pointer; display: block; }
.image-placeholder {
  width: 48px; height: 48px; border: 1px dashed var(--border); border-radius: 6px; background: none;
  color: var(--ink-muted); font-size: .64rem; cursor: pointer; padding: 0;
}
.image-remove-btn {
  position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 50%;
  border: none; background: var(--danger); color: #fff; font-size: .65rem; line-height: 1; cursor: pointer; padding: 0;
}
/* 그리드 셀 썸네일에 2장 이상 있을 때 우측 하단에 붙는 "+N" 뱃지 — 몇 장인지 셀을 열지
   않고도 바로 알 수 있게. */
.image-count-badge {
  position: absolute; bottom: -4px; right: -4px; background: var(--ink); color: var(--bg);
  font-size: .6rem; font-weight: 700; border-radius: 999px; padding: 1px 5px; line-height: 1.3;
  pointer-events: none;
}
/* 이미지 팝업 안의 여러 장 갤러리 — 각 썸네일 우상단에 기존 .image-remove-btn(×) 재사용 */
.image-gallery { display: flex; flex-wrap: wrap; gap: .6rem; }
.image-gallery-item { position: relative; width: 96px; height: 96px; flex-shrink: 0; }
.image-gallery-thumb {
  width: 96px; height: 96px; object-fit: cover; border-radius: 8px; display: block;
  border: 1px solid var(--border); cursor: zoom-in;
}

/* 이미지/BOM/상품정보고시 팝업은 모델명 일괄수정·신규 상품 등록 팝업(같은 .modal, 같은
   z-index:30) "안"에서 셀을 눌러 열릴 수 있는 한 단계 더 깊은 팝업이다 — 같은 z-index면
   DOM에 나중에 나오는 쪽(이 경우 뒤에 추가된 일괄수정/신규등록 팝업)이 위로 덮어버려서
   방금 연 이미지 팝업이 뒤에 숨어버렸었다. 셀 단위 팝업들을 한 단계 더 높여서 항상
   위에 뜨도록 고정. */
#imageModal, #bomModal, #disclosureModal { z-index: 35; }
#imageModalBackdrop, #bomModalBackdrop, #disclosureModalBackdrop { z-index: 34; }

/* click-to-browse / drag-drop / paste image target — used by the pricing image
   modal and the 신상품관리 photo field */
.image-drop-zone {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 140px; border: 2px dashed var(--border); border-radius: 10px; cursor: pointer;
  padding: 1rem; color: var(--ink-muted); font-size: .84rem; background: var(--surface-2);
}
.image-drop-zone:hover, .image-drop-zone:focus-visible { border-color: var(--accent); color: var(--ink); outline: none; }
.image-drop-zone.drag-over { border-color: var(--accent); background: var(--surface); color: var(--accent); }
.image-preview-img { max-width: 100%; max-height: 220px; border-radius: 8px; object-fit: contain; cursor: zoom-in; }
/* smaller variant used side-by-side (신상품관리 사진/도면) instead of the full-width pricing modal use */
.image-drop-zone-sm { min-height: 56px; width: 110px; padding: .35rem; font-size: .68rem; line-height: 1.3; }
.image-drop-zone-sm .image-preview-img { max-height: 48px; }
/* <label for="..."> rather than a JS-driven button — native label-for is the browser's own
   trusted mechanism for opening a file picker, immune to whatever was blocking the old
   programmatic input.click() approach (extension policy, gesture-tracking edge cases, etc.).
   Since it's a label now (not a <button>), it needs its own full look instead of inheriting
   the global button {...} rule. */
.upload-btn {
  display: flex; align-items: center; justify-content: center;
  width: 110px; margin-top: .3rem; font-size: .74rem; font-weight: 600; padding: .3rem 0;
  font-family: var(--font); border-radius: 8px; border: 1px solid var(--border);
  background: none; color: var(--ink); cursor: pointer; text-align: center;
}
.upload-btn:hover { border-color: var(--accent); color: var(--accent); }

/* BOM cells */
.grid-table td.bom-cell { padding: .3rem .5rem; }
.bom-cell-btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); border-radius: 999px;
  padding: .3rem .7rem; font-size: .8rem; cursor: pointer; white-space: nowrap;
}
.bom-cell-btn strong { color: var(--accent); }

.modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-inner {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 420px; max-width: 92vw;
  max-height: 84vh; overflow-y: auto; padding: 1.4rem 1.6rem; display: flex; flex-direction: column; gap: .9rem;
  box-shadow: 0 16px 48px rgba(0,0,0,.24);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.modal-head h2 { margin: 0; font-size: 1.05rem; }
.modal-inner label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--ink-muted); }
.checkbox-label { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--ink-muted); }
.bom-list { display: flex; flex-wrap: wrap; gap: .5rem; min-height: 2rem; }
.bom-empty { color: var(--ink-muted); font-size: .85rem; }
.bom-chip {
  display: flex; align-items: center; gap: .35rem; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: .35rem .5rem .35rem .8rem; font-size: .82rem;
}
.bom-chip-code { font-weight: 700; }
.bom-chip-name { color: var(--ink-muted); }
.bom-chip-qty { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.bom-chip-remove {
  width: 18px; height: 18px; border-radius: 50%; border: none; background: var(--danger); color: #fff;
  font-size: .68rem; line-height: 1; cursor: pointer; padding: 0;
}
.bom-add-row { display: flex; gap: .5rem; align-items: center; }
.bom-add-row select { flex: 1; min-width: 0; }
.bom-add-row input[type="text"] { flex: 1; min-width: 0; }
.bom-add-row input[type="number"] { width: 4.2rem; }

/* small right-click context menu, positioned next to the cursor via inline left/top */
.context-menu {
  position: fixed; z-index: 40; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: .3rem; min-width: 140px;
}
.context-menu.hidden { display: none; }
.context-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none; color: var(--ink);
  font-weight: 500; font-size: .85rem; padding: .5rem .6rem; border-radius: 6px; cursor: pointer;
}
.context-menu button:hover { background: var(--surface-2); }

/* floating zoom + pan controls (site-wide, sit outside the zoomed .app-shell) */
.floating-zoombar {
  position: fixed; bottom: 20px; right: 20px; transform: scale(0.8); transform-origin: bottom right;
  display: flex; align-items: center; gap: .6rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: .5rem 1rem; box-shadow: 0 8px 24px rgba(0,0,0,.18); z-index: 1000;
}
.floating-zoombar button {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink); font-size: 1rem; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.floating-zoombar input[type="range"] { width: 120px; }
.floating-zoombar .zoom-label { font-size: .78rem; color: var(--ink-muted); width: 3.2em; text-align: center; font-variant-numeric: tabular-nums; }
.floating-zoombar .zoom-icon { font-size: .9rem; }

.floating-hscroll {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 999; padding: .55rem 1.15rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink-muted); box-shadow: 0 8px 24px rgba(0,0,0,.18);
  cursor: grab; opacity: .45; font-size: .95rem; letter-spacing: .15em; user-select: none;
  transition: opacity .15s;
}
.floating-hscroll:hover { opacity: .9; }
.floating-hscroll.dragging { opacity: .95; cursor: grabbing; }

.panel { position: fixed; top: 0; right: 0; height: 100vh; width: 380px; background: var(--surface); border-left: 1px solid var(--border); z-index: 27; box-shadow: -8px 0 24px rgba(0,0,0,.08); overflow-y: auto; }
.panel.hidden { display: none; }
.panel-inner { padding: 1.6rem; display: flex; flex-direction: column; gap: 1rem; }
.panel label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--ink-muted); }
.panel .checkbox-label { flex-direction: row; align-items: center; gap: .5rem; }
.panel-actions { display: flex; gap: .6rem; margin-top: .4rem; }
/* Must outrank the sticky .toolbar (z-index 25) and table header (z-index 5) —
   both are position:sticky/fixed and previously painted over the top of this panel
   since it had a lower z-index than the toolbar. */
.panel-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 26; }
.panel-backdrop.hidden { display: none; }
.hidden { display: none !important; }

.form-error { background: var(--danger-soft); color: var(--danger); padding: .6rem .8rem; border-radius: 8px; font-size: .84rem; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2.4rem 2.2rem; width: 320px; display: flex; flex-direction: column; gap: .8rem; }
.login-card .brand { color: var(--accent); font-weight: 700; font-size: .85rem; }
.login-card h1 { margin-bottom: .6rem; }
.login-card label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--ink-muted); }
.login-card button { margin-top: .4rem; }

.tabs { display: flex; gap: .4rem; margin-bottom: 1rem; }
.tabs .tab { background: none; border: 1px solid var(--border); color: var(--ink-muted); }
.tabs .tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* 매출·광고 분석 — 상태 필터 버튼(전체/ON/OFF), 탭과 동일한 활성 표시 패턴 재사용 */
.camp-status-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.promo-channel-btn.active, .promo-status-btn.active, .promo-cal-channel-btn.active, .dp-status-btn.active, .iti-status-btn.active, .pd-status-btn.active, .dpr-status-btn.active, #shortageOnlyBtn.active {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
.promo-cal-channel-bar { flex-wrap: wrap; margin-bottom: .5rem; }

/* 재고관리 — 자재 부족 배지 */
.badge-warn { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .74rem; background: #F4D9D5; color: #A6403F; }
.bom-tab-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.stock-tier-btn.active, .voucher-type-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.prod-tab-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.work-subtab-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cal-view-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* 생산관리 — BOM 시뮬레이션 (자재→반제품→제품→상품 4열 보드 + SVG 연결선) */
.bom-sim-board-scroll { overflow-x: auto; padding-bottom: .3rem; }
.bom-sim-board { position: relative; display: flex; gap: 2.4rem; min-width: fit-content; align-items: flex-start; }
.bom-sim-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 1; }
.bom-sim-svg path { fill: none; stroke: var(--ink-muted); stroke-width: 1.4; opacity: .35; transition: opacity .1s, stroke-width .1s; }
.bom-sim-svg path.bom-sim-edge-active { stroke: var(--accent); stroke-width: 2.4; opacity: .95; }
.bom-sim-col { position: relative; z-index: 2; flex: 1 1 460px; min-width: 460px; max-width: 540px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.bom-sim-col-head {
  font-weight: 700; font-size: .88rem; padding: .6rem .8rem; background: var(--surface-2);
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
}
.bom-sim-col-list { max-height: 60vh; overflow-y: auto; }
.bom-sim-table { width: 100%; table-layout: fixed; }
.bom-sim-table th, .bom-sim-table td { text-align: right; }
.bom-sim-table th:nth-child(1), .bom-sim-table th:nth-child(2), .bom-sim-table td:nth-child(1), .bom-sim-table td:nth-child(2) { text-align: left; }
.bom-sim-table td.computed { background: var(--surface-2); color: var(--ink-muted); }
.bom-sim-table td input[type="number"] {
  width: 100%; text-align: right; border: 1px solid var(--border); border-radius: 6px; padding: .2rem .4rem;
  background: var(--surface); color: var(--ink); font-variant-numeric: tabular-nums;
}
.bom-sim-table td input[type="number"].invalid { border-color: var(--danger); outline: 1px solid var(--danger); }
.bom-sim-table tr.bom-sim-row-highlight { background: var(--warn-bg); }
.bom-sim-table tr.bom-sim-row-selected { background: var(--warn-bg); border-left: 3px solid var(--accent); }
.bom-sim-table tr.bom-sim-row-dim { opacity: .4; }
.bom-sim-toolbar-selection { font-size: .82rem; color: var(--ink-muted); }
.bom-sim-shortage { display: inline-flex; align-items: center; gap: 3px; }
.bom-sim-footer { display: flex; align-items: flex-end; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.bom-sim-save-result {
  margin-top: .8rem; padding: .8rem 1rem; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--border); font-size: .86rem; white-space: pre-line;
}

/* 신상품관리 */
.status-badge {
  display: inline-flex; align-items: center; font-size: .74rem; font-weight: 600; padding: .2rem .6rem;
  border-radius: 999px; background: var(--surface-2); color: var(--ink-muted);
}
.status-badge.status-proposed { background: var(--surface-2); color: var(--accent); }
.status-badge.status-researching { background: var(--warn-bg); color: var(--warn-ink); }
.status-badge.status-confirmed { background: var(--success-soft); color: var(--success); }
.status-badge.status-rejected { background: var(--danger-soft); color: var(--danger); }
.research-row { display: flex; gap: .5rem; margin-bottom: .5rem; }
.research-row input { flex: 1; min-width: 0; }
.attachment-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.memo-log-btn { align-self: flex-start; }
.memo-log-list { display: flex; flex-direction: column; gap: .6rem; max-height: 60vh; overflow-y: auto; }
.memo-log-entry { border: 1px solid var(--border); border-radius: 8px; padding: .6rem .7rem; font-size: .85rem; }
.memo-log-meta { color: var(--ink-muted); font-size: .76rem; margin-bottom: .3rem; }
.memo-log-old { color: var(--ink-muted); text-decoration: line-through; white-space: pre-wrap; }
.memo-log-arrow { color: var(--ink-muted); margin: .15rem 0; }
.memo-log-new { white-space: pre-wrap; }
.attachment-chip {
  display: flex; align-items: center; gap: .35rem; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: .3rem .5rem .3rem .8rem; font-size: .82rem;
}
.attachment-remove {
  width: 18px; height: 18px; border-radius: 50%; border: none; background: var(--danger); color: #fff;
  font-size: .68rem; line-height: 1; cursor: pointer; padding: 0;
}
.options-head { display: flex; align-items: center; justify-content: space-between; margin-top: .4rem; }
.options-head h3 { margin: 0; }
.options-head-actions { display: flex; gap: .5rem; }
.column-visibility-list { display: flex; flex-direction: column; gap: .1rem; max-height: 60vh; overflow-y: auto; }
/* .modal-inner label sets flex-direction:column globally (for stacked label+input fields) —
   override back to row here since this label is a checkbox+text pair, not a field. The extra
   .column-visibility-list ancestor in the selector is what wins the specificity tie. */
.column-visibility-list .column-visibility-row { display: flex; flex-direction: row; align-items: center; gap: .6rem; padding: .4rem .3rem; font-size: .88rem; border-bottom: 1px solid var(--border); }
.column-visibility-row:last-child { border-bottom: none; }
.column-visibility-name { flex: 1; min-width: 0; }
.column-visibility-move { display: flex; gap: .2rem; flex-shrink: 0; }
.column-visibility-move button {
  width: 22px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface-2); color: var(--ink); font-size: .68rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.column-visibility-move button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.column-visibility-move button:disabled { opacity: .3; cursor: default; }
#optionsList .sub, .panel-inner .sub { color: var(--ink-muted); font-size: .82rem; margin: .2rem 0 .6rem; }
.option-row {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: .6rem .7rem; margin-bottom: .6rem;
}
.option-row-head {
  display: flex; align-items: center; justify-content: space-between; font-size: .82rem;
  font-weight: 600; color: var(--ink-muted); margin-bottom: .4rem;
}
.option-row-fields { display: flex; flex-wrap: wrap; gap: .5rem; }
.option-field { display: flex; flex-direction: column; gap: .2rem; font-size: .78rem; min-width: 6.5rem; flex: 1; }
.option-field input { width: 100%; }

/* proposal list thumbnail (대표이미지) */
.row-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; cursor: zoom-in; display: block; }
.row-thumb-empty { background: var(--surface-2); }

/* fullscreen click-to-enlarge overlay, shared by list thumbnails + 사진/도면 previews */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.78);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox.hidden { display: none; }
.lightbox img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: 6px; }

/* 신상품 제안 편집 — large centered modal (grew from a right slide panel, then grew again
   to near-fullscreen once the options sheet became the main work surface). Fixed height
   (not just max-height) turns .modal-inner's flex column into a real budget: the compact
   top strip + headings take their natural size, and .options-sheet-wrap (the only flex
   child with flex:1) soaks up everything left over — see its comment below for why that
   needs flex-shrink handling too. */
/* resize:both gives a native drag handle (bottom-right corner) for width+height. No JS needed
   to re-center: .modal is a flex container with align-items:center + justify-content:center,
   so it recenters on both axes automatically as size changes on every drag step. Needs
   overflow != visible to activate per spec — already have overflow-y:auto from .modal-inner;
   overflow:auto here just also covers the x-axis. Ceiling is 99% of the viewport per request. */
/* 상품정보고시 팝업 — 24개 항목 라벨+입력을 나란히 보여줘야 해서 기본 420px론
   좁음(라벨만 보이고 입력칸이 화면 밖으로 밀림). BOM 모달 등 다른 작은 모달과는
   별도 클래스로 넓힘. */
.modal-inner-disclosure { width: 640px; max-width: 92vw; }
.modal-inner-disclosure .disclosure-table { width: 100%; max-width: none; }

/* 프로모션 상세 팝업처럼 라벨+입력 여러 쌍을 한 줄(.inline-row)에 욱여넣으면 간격이
   좁고 읽기 힘들어진다 — 2열 그리드로 항목마다 충분한 여백을 주고, 섹션(기본정보/채널/
   설명/적용상품)마다 구분선+여백을 둬서 시각적으로 나눈다. */
/* 2026-09-10: 사용자가 "2배로 더 키워달라"고 요청 — 대부분의 화면에서는 max-width(95vw
   -> 97vw로 소폭 확대)가 실제 상한이 되어 화면을 거의 꽉 채우고, 초광폭 모니터에서는
   width 2160px까지 커진다. 세로도 마찬가지로 부족하다는 후속 요청 — 기본 .modal-inner의
   max-height:84vh를 이 모달만 95vh로 올림(내용이 그보다 짧으면 지금처럼 내용 크기만큼만
   차지, 넘치면 기존 overflow-y:auto로 내부 스크롤). */
.modal-inner-medium { width: 2160px; max-width: 97vw; max-height: 95vh; }
#promotionModal .search-connect-wrap { max-width: none; }
.promo-products-table { table-layout: auto; }
.promo-products-table th, .promo-products-table td { white-space: nowrap; }
/* 채널별 수수료/마진 칼럼 쌍 위에 채널명을 한 번만 보여주는 그룹행 — 단품관리의
   #pricingGroupRow와 같은 이유로, 헤더행이 그 아래(24px)에 오도록 오프셋을 준다. */
#promoProductsGroupRow th {
  position: sticky; top: 0; z-index: 6; height: 24px; padding: 0 .5rem;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
#promoProductsHeadRow th { top: 24px; }
.promo-channel-group-th {
  text-align: center; font-size: .74rem; font-weight: 600; color: var(--ink-muted);
}
/* 인쇄 설정 팝업은 작고 화면 정중앙에 뜨는데, 좌우 이동용 floating-hscroll 버튼도
   화면 정중앙에 z-index:999로 떠 있어(다른 큰 팝업은 내용이 넓어 덜 겹쳐 보였을 뿐)
   체크박스 글자를 가려버린다 — 이 팝업(+백드롭)만 그보다 위로 올려서 항상 앞에 오게. */
#printSettingsBackdrop { z-index: 1000; }
#printSettingsModal { z-index: 1001; }
.promo-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.4rem; }
.promo-form-grid .span-2 { grid-column: 1 / -1; }
.promo-field-group { margin-top: 1.3rem; }
.promo-field-group-label { display: block; font-size: .85rem; color: var(--ink-muted); margin-bottom: .5rem; }
.promo-channel-box {
  display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; padding: .8rem .9rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
}
.promo-section-divider { border-top: 1px solid var(--border); margin-top: 1.6rem; padding-top: 1.4rem; }
.promo-section-divider h3 { margin: 0 0 .3rem; }
.promo-section-divider .col-settings { margin-left: .6rem; }
/* 적용상품 표 — 상품명을 눌러 펼치면 그 판매상품에 연결된 단품(옵션)들이 들여쓰기+다른
   배경색으로 아래에 나열된다(단품별로도 판매가/데이터를 점검할 수 있게 해달라는 요청). */
.promo-expand-toggle { display: inline-block; width: 1rem; cursor: pointer; color: var(--ink-muted); user-select: none; }
.promo-expand-toggle:hover { color: var(--ink); }
.promo-option-row td { background: var(--surface-2); }
.promo-option-indent { padding-left: 1.6rem; display: inline-block; color: var(--ink-muted); }

.promo-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
/* 목록 "프로모션명" 칼럼 앞의 색점 — 캘린더 막대와 같은 색으로 배정해서 연계를 보여준다. */
.promo-color-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .5rem; vertical-align: middle; flex-shrink: 0; }

/* 프로모션 캘린더 팝업 — 요일 헤더 + 주 단위 행(날짜 숫자 줄 + 이벤트 막대 줄). 막대는
   position:absolute지만 grid-column으로 폭을 잡는다(grid 컨테이너의 grid-column 배치
   속성은 absolutely-positioned 자식에도 그대로 적용됨 — 별도 라이브러리 없이 여러 날에
   걸친 막대를 표현하는 표준적인 방법). */
/* 세로를 최대한 키워달라는 요청 — 팝업 자체를 뷰포트 높이에 최대한 맞춘 고정 높이로
   만들고(기존엔 max-height만 있어서 내용만큼만 짧게 잡혔음), .modal-inner의 flex column
   구조(제목줄+요일줄+그리드) 안에서 그리드가 flex:1로 남는 세로공간을 전부 차지하게,
   그 안의 각 주(week)도 flex:1로 균등하게 나눠 가지도록 해서 실제로 세로가 커진다. */
#promoCalendarModal .modal-inner { height: 92vh; max-height: 92vh; }
/* 모델명 일괄수정/신규 상품 등록 — 안에 표가 커서 세로를 최대한 키워달라는 요청.
   기본 .modal-inner-medium은 max-height만 있어서 내용이 적으면 짧게 잡혔는데, height를
   고정해서 항상 화면 세로의 대부분을 채우게 한다(캘린더 팝업과 동일한 패턴). */
#bulkModelModal .modal-inner, #newProductModal .modal-inner { height: 92vh; max-height: 92vh; }
.promo-cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); font-size: .78rem; color: var(--ink-muted); padding: 0 .2rem; margin-top: .4rem; flex-shrink: 0; }
.promo-cal-weekdays > div { text-align: center; padding: .3rem 0; }
.promo-cal-grid { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; }
.promo-cal-week { border-top: 1px solid var(--border); padding-top: 2px; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.promo-cal-daynums { display: grid; grid-template-columns: repeat(7, 1fr); flex-shrink: 0; }
.promo-cal-daynum { font-size: .76rem; color: var(--ink-muted); padding: 2px 6px; text-align: right; }
.promo-cal-daynum.promo-cal-outside { color: var(--border); }
/* 오늘 날짜 — 글자색만으로는 눈에 잘 안 띄어서 구글 캘린더처럼 동그라미 배지로 표시 */
.promo-cal-today-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 999px; background: var(--accent);
  color: #fff; font-weight: 700;
}
.promo-cal-events { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); flex: 1; min-height: 0; }
.promo-cal-bar {
  /* left/right:0 필수 — grid-column만 지정하고 inset을 auto로 두면 절대배치 그리드
     아이템은 span한 칸 전체로 안 늘어나고 텍스트 내용만큼만 shrink-to-fit 되어버려서
     여러 날에 걸친 기간이 첫 칸 하나 너비로만 보이는 버그가 났었음(실측 getBoundingClientRect로
     확인) — left/right를 0으로 고정해야 grid-column이 정한 영역 전체를 채운다. */
  position: absolute; left: 0; right: 0; height: 22px; line-height: 22px; font-size: .78rem; color: #fff;
  padding: 0 6px; margin: 0 2px; border-radius: 4px; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; cursor: pointer; box-sizing: border-box;
}
.promo-cal-bar:hover { filter: brightness(1.1); }

/* 디자인관리 - 캘린더(design_calendar.js) — 프로모션 캘린더와 달리 기간 막대가 아니라
   날짜 하나짜리 "마감일" 이벤트만 나열하면 되므로, grid-column 스팬 계산 없이 각
   날짜 칸 안에 칩을 위에서부터 쌓는 훨씬 단순한 레이아웃을 쓴다. */
.design-cal-legend { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; color: var(--ink-muted); margin-right: .8rem; }
.design-cal-dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.design-cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); font-size: .78rem; color: var(--ink-muted); padding: .6rem .2rem 0; }
.design-cal-weekdays > div { text-align: center; padding: .3rem 0; }
.design-cal-grid { display: flex; flex-direction: column; }
.design-cal-week { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--border); }
.design-cal-day { min-height: 92px; padding: 4px; border-right: 1px solid var(--border); box-sizing: border-box; }
.design-cal-day:last-child { border-right: none; }
.design-cal-daynum { font-size: .78rem; color: var(--ink-muted); text-align: right; margin-bottom: 2px; }
.design-cal-daynum.design-cal-outside { color: var(--border); }
/* 토/일요일과 공휴일 날짜 표시 — 공휴일명은 그 밑에 작게 표시 */
.design-cal-daynum.cal-red-day { color: var(--danger); }
.design-cal-holiday-label {
  font-size: .68rem; color: var(--danger); text-align: right; margin: -2px 0 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.design-cal-event {
  font-size: .72rem; padding: 1px 5px; border-radius: 4px; margin-bottom: 2px; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; display: block;
}
.design-cal-event:hover { filter: brightness(1.1); }
.design-cal-event.design-cal-done { opacity: .5; text-decoration: line-through; }
.design-cal-period {
  font-size: .72rem; padding: 1px 5px; border-radius: 4px; margin-bottom: 2px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; display: block;
}
.design-cal-period:hover { filter: brightness(.95); }
.design-cal-period.design-cal-done { text-decoration: line-through; }

/* 발주서보정 미리보기 — 자동 계산/정리된 칸은 옅은 배경으로 구분, 매칭 실패 행은
   경고색, 모든 셀은 클릭해서 직접 고칠 수 있음(마스터관리 인라인수정과 동일 패턴). */
.po-preview-scroll { max-height: 60vh; }
.po-cell { cursor: text; }
.po-cell:hover { background: var(--surface-2); }
.po-changed-cell { background: var(--info-tint); }
.po-unmatched-row td { background: var(--danger-soft); }
.po-duplicate-row td { background: var(--warn-bg); color: var(--warn-ink); border-top: 2px solid #f08c00; border-bottom: 2px solid #f08c00; }
.po-duplicate-row td:first-child { border-left: 2px solid #f08c00; }
.po-duplicate-row td:last-child { border-right: 2px solid #f08c00; }
#poPreviewHead th:first-child, #poPreviewBody td:first-child { width: 32px; text-align: center; white-space: nowrap; }
.po-edit-log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; font-size: .85rem; }
.po-edit-log-list li { border-bottom: 1px solid var(--border); padding-bottom: .4rem; }
.po-edit-log-list .sub { margin-right: .5rem; }
/* 시작~종료일 달력 입력(flatpickr, range 모드) — 직접 타이핑 대신 항상 달력에서만
   고르게 readonly로 두되, 클릭 가능함을 보여주려고 커서만 pointer로 바꾼다. */
#promoPeriod { cursor: pointer; background: var(--surface); }
.flatpickr-calendar { font-size: .9rem; }
/* 저장/삭제/닫기를 팝업 하단이 아니라 상단 제목표시줄에 두고, 스크롤해도 항상 보이게
   고정한다 — .modal-inner가 overflow-y:auto인 스크롤 컨테이너라 position:sticky의
   top:0은 그 패딩 안쪽 시작점 기준이라 이 헤더가 항상 그 자리에서 스크롤을 붙잡는다.
   배경색이 .modal-inner와 동일(var(--surface))이라 좌우 패딩 거너 부분과 이 헤더의
   경계가 안 보여서 .toolbar처럼 음수 마진으로 폭을 넓힐 필요가 없다. */
.modal-head-sticky {
  position: sticky; top: 0; z-index: 5; background: var(--surface);
  padding-bottom: .7rem; margin-bottom: .2rem; border-bottom: 1px solid var(--border);
}
.modal-head-sticky #promoError { display: block; margin-top: .5rem; }
.modal-head-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
/* 쇼핑몰 상품코드로 적용상품 찾기 — 이름 검색창 바로 아래 병행 입력줄. */
.promo-code-add-row { margin-top: .5rem; }
.promo-code-add-row input[type="text"] { flex: 1; }

/* 프로모션 목록 위 "중복 프로모션 마진 경고" 패널 — 목록 영역의 대략 1/3을 차지하도록
   고정 높이(내부 스크롤)를 준다. 카드 자체는 .card와 동일한 톤이지만 별도 클래스로 둬서
   폭 넓은 표 레이아웃에 맞는 패딩을 쓴다. */
.promo-overlap-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem 1.2rem; margin-bottom: 1.2rem;
}
.promo-overlap-panel h3 { margin: 0 0 .3rem; font-size: 1rem; }
.promo-overlap-scroll { max-height: 260px; }
.promo-overlap-panel .empty-note { color: var(--ink-muted); font-size: .85rem; padding: .4rem 0; }
.modal-inner-wide {
  width: 99vw; max-width: 99vw; min-width: 700px; height: 92vh; max-height: 99vh; min-height: 400px; align-items: stretch;
  resize: both; overflow: auto; padding: 0;
}
/* #proposalZoomWrap (products.js) sets zoom + width/height here to mirror the site's own
   돋보기 setting — padding moves down onto it (with border-box) so the padding itself scales
   with everything else instead of looking oversized at low zoom / cramped at high zoom. */
.modal-zoom-wrap {
  display: flex; flex-direction: column; gap: .9rem;
  padding: 1.4rem 1.6rem; box-sizing: border-box;
}
.modal-inner-wide .modal-head { flex-wrap: wrap; flex-shrink: 0; }
.proposal-top-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; flex-shrink: 0; }
.proposal-top-col { display: flex; flex-direction: column; gap: .4rem; }
.proposal-top-col h3 { margin: .15rem 0 0; font-size: .84rem; }
.proposal-info-row { display: flex; gap: .8rem; align-items: flex-start; }
.proposal-info-fields { flex: 1; display: flex; flex-direction: column; gap: .35rem; }
.proposal-info-fields label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--ink-muted); }
.proposal-info-fields-row { display: flex; gap: .5rem; }
.proposal-info-fields-row label { flex: 1; min-width: 0; }
.attach-upload-row { display: flex; gap: .4rem; }
.attach-upload-row select { width: 5.5rem; flex-shrink: 0; }
.attach-upload-row input[type="file"] { min-width: 0; flex: 1; font-size: .78rem; }
.options-block { display: flex; flex-direction: column; gap: .25rem; flex: 1 1 auto; min-height: 0; }
.options-head { flex-shrink: 0; margin-top: 0; }

/* 옵션별 데이터 — 가격관리 그리드처럼 행=옵션/열=칼럼인 실제 표. flex:1 + min-height:0 makes
   this the one part of the modal that grows to fill all remaining space ("최대한 크게").
   flex-shrink alone isn't enough here — a flex item with non-visible overflow also needs an
   explicit min-height:0 override, otherwise its automatic min-height (based on content) still
   wins over max-height/flex-basis and the sheet refuses to shrink back down when it's tall. */
.options-sheet-wrap {
  overflow: auto; border: 1px solid var(--border); border-radius: 8px;
  flex: 1 1 auto; min-height: 220px;
}
/* table-layout:fixed + a JS-computed explicit table width (see renderOptionsSheet) is what
   lets mouse-drag column resize work here — same requirement as the main pricing grid. */
table.options-sheet { table-layout: fixed; border-collapse: collapse; font-size: .82rem; }
.options-sheet th, .options-sheet td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: .45rem .6rem; text-align: left; white-space: nowrap; overflow: hidden; box-sizing: border-box; position: relative; }
/* body rows are 2x header height (padding, not font-size) so image-column thumbnails have room
   to render larger without also blowing up the sticky header row. */
.options-sheet tbody td { padding-top: .95rem; padding-bottom: .95rem; }
.options-sheet th:last-child, .options-sheet td:last-child { border-right: none; }
.options-sheet thead th { background: var(--surface-2); font-weight: 700; position: sticky; top: 0; z-index: 2; }
.options-sheet td input { border: none; background: none; padding: 0; width: 100%; font-size: .84rem; color: var(--ink); }
.options-sheet tbody tr:last-child td { border-bottom: none; }
.options-sheet tbody tr:hover td { background: var(--surface-2); }
/* link-format cells reserve space for the 🔗 icon with padding rather than display:flex —
   display:flex on a table cell inside a table-layout:fixed table blew row height up to
   600px+ in testing (the same class of table+flex sizing conflict documented elsewhere in
   this file for the pricing grid's column-group header). Absolute-positioned icon avoids it. */
.options-sheet td.link-cell input { padding-left: 1.1rem; }
/* 상품관리 옵션 표(catalog.js renderOptionsTable) — 행 맨 앞 드래그 손잡이로 순서 변경 */
.drag-handle-cell { width: 28px; text-align: center; padding: 0 !important; }
.drag-handle { display: inline-block; cursor: grab; color: var(--ink-muted); font-size: .95rem; user-select: none; }
.drag-handle:active { cursor: grabbing; }
#optionsTable tbody tr.drag-over,
#bulkModelTable tbody tr.drag-over,
#newProductTable tbody tr.drag-over,
#personalTaskOrderTable tbody tr.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }

.options-col-resizer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 10px; cursor: col-resize; z-index: 3;
  border-right: 2px solid transparent;
}
.options-col-resizer:hover, .options-col-resizer:active { border-right-color: var(--accent); }
.cell-link-icon { position: absolute; left: .35rem; top: 50%; transform: translateY(-50%); text-decoration: none; cursor: pointer; font-size: .78rem; line-height: 1; z-index: 1; }
.cell-link-text { overflow: hidden; text-overflow: ellipsis; }

/* image-type option columns (옵션별 데이터) — thumbnail + upload label, inline (not flex) to
   avoid the same table+flex row-height blowup documented above for .options-sheet td. */
.option-image-cell { white-space: nowrap; }
.option-image-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; vertical-align: middle; cursor: zoom-in; margin-right: .3rem; }
.option-image-thumb.hidden { display: none; }
.option-image-upload-btn {
  display: inline-block; vertical-align: middle; font-size: .68rem; padding: .1rem .4rem;
  border: 1px solid var(--border); border-radius: 4px; cursor: pointer; color: var(--ink-muted); background: var(--surface);
}
.option-image-upload-btn:hover { border-color: var(--accent); color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem; }
.master-add-row { display: flex; gap: .6rem; margin-bottom: 1rem; }
.master-add-row .sub { margin-left: .4rem; }
#masterTableBody .editable-cell { cursor: text; }
#masterTableBody .editable-cell:hover { background: var(--surface-2); }
.cal-task-table .editable-cell { cursor: text; }
.cal-task-table .editable-cell:hover { background: var(--surface-2); }
.cal-task-table .editable-cell input { width: 100%; box-sizing: border-box; }
.cal-order-handle { display: inline-block; cursor: grab; color: var(--ink-muted); font-size: .95rem; user-select: none; }
.cal-order-handle:active { cursor: grabbing; }
/* 고정업무 반복 주기 셀 편집 중에는 select 여러 개가 여러 줄로 들어가므로, 그 칸만
   table의 기본 white-space:nowrap/overflow:hidden 잘림을 풀어서 줄바꿈되게 한다. */
.cal-task-table td.recur-editing { white-space: normal; overflow: visible; }

/* 인라인 편집 칸/드래그 순서변경 손잡이의 범용 스타일(캘린더 전용이 아닌 다른 표에서도 재사용) */
.grid-table .editable-cell { cursor: text; }
.grid-table .editable-cell:hover { background: var(--surface-2); }
.grid-table .editable-cell input, .grid-table .editable-cell select { width: 100%; box-sizing: border-box; }
.grid-table tbody tr.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.grid-table tr.summary-detail-row td { background: var(--surface-2); color: var(--ink-muted); }
.grid-table tfoot tr.summary-total-row td { font-weight: 700; border-top: 2px solid var(--border); }

/* ---------- CS통합관리: 왼쪽 통합 기록 표 + 오른쪽 구분별 4단 요약 ---------- */
.cs-shell { display: flex; gap: 0; align-items: flex-start; }
.cs-main { flex: 1 1 58%; min-width: 320px; }
/* 좌우 비율 드래그 조정 손잡이 — 실제 폭 계산/드래그 처리는 cs_integrated.js에서. */
.cs-resizer { flex: 0 0 14px; width: 14px; cursor: col-resize; align-self: stretch; display: flex; align-items: center; justify-content: center; }
.cs-resizer::before { content: ""; width: 2px; height: 100%; background: var(--border); border-radius: 2px; transition: background .15s ease, width .15s ease; }
.cs-resizer:hover::before, .cs-resizer.cs-resizer-active::before { background: var(--accent); width: 3px; }
/* 페이지 전역 .toolbar는 좌우로 화면 끝까지 번지는 음수 마진 + sticky를 쓰는데(전체 폭
   1칼럼 페이지 전제), 이 페이지는 좌우 분할이라 그대로 쓰면 툴바가 오른쪽 목록 위로
   넘쳐서 가려버린다 — 이 페이지 안에서는 넘치지 않게 무효화한다. */
.toolbar.cs-toolbar { margin: 0 0 .6rem; padding: 0; position: static; background: none; border-bottom: none; flex-wrap: wrap; }
/* 화면 아래 끝까지 채우기 — 단순 vh만으로는 위쪽에 이미 쓰인 페이지 제목/툴바/여백
   높이를 못 빼므로 그만큼 실측해서 calc로 뺀다(.content 위아래 패딩 2rem×2 + 페이지
   제목/서브텍스트 + 툴바 높이 ≈ 210px). 이러면 세로 스크롤이 두 번 생기지 않고 표/오른쪽
   목록 아래쪽이 화면(뷰포트) 바닥에 맞춰 딱 끝난다. */
.cs-table-scroll { height: calc(100vh - 210px); }
.cs-side { flex: 1 1 42%; min-width: 260px; display: flex; flex-direction: column; gap: .7rem; height: calc(100vh - 210px); }
.cs-side-panel { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.cs-side-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; padding: .5rem .8rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cs-side-count { font-size: .78rem; color: var(--ink-muted); }
.cs-side-status-filter { display: flex; gap: .25rem; }
.cs-side-status-btn {
  font-size: .72rem; font-weight: 600; padding: .2rem .5rem; border-radius: 999px; border: 1px solid var(--border);
  background: none; color: var(--ink-muted); cursor: pointer;
}
.cs-side-status-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cs-side-settings-btn { padding: .2rem .45rem; font-size: .8rem; }
.cs-side-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.cs-side-item { padding: .45rem .8rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.cs-side-item:hover { background: var(--surface-2); }
.cs-side-item-date { font-size: .72rem; color: var(--ink-muted); }
.cs-side-item-summary { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-row-flash { outline: 2px solid var(--accent); outline-offset: -2px; transition: outline-color .3s ease; }
/* 틀고정 칼럼 — position:sticky는 colgroup이 아니라 th/td 각각에 인라인 left를 계산해서
   붙인다(단품관리 app.js/catalog.js와 같은 방식, .frozen-col/.frozen-edge 클래스 재사용). */
.cs-record-table th.frozen-col, .cs-record-table td.frozen-col { position: sticky; }
@media (max-width: 960px) {
  .cs-shell { flex-direction: column; }
  .cs-main, .cs-side { flex: 1 1 auto !important; width: 100%; }
  .cs-resizer { display: none; }
  .cs-side { height: auto; }
  .cs-side-panel { min-height: 160px; }
  .cs-table-scroll { height: 60vh; }
}

/* ---------- 개인업무관리 1:6 레이아웃 + TODO 드로어(화면 폭과 무관하게 항상 드로어) ----------
   원래는 1:6:3 고정 3칸이었으나, 넓은 화면에서도 TODO가 "본문과 붙어있는 별도 칸"처럼
   애매하게 보인다는 피드백으로 폭 조건 없이 항상 오른쪽 드로어(토글 버튼으로 열고 닫기)로
   바꿨다. 이후 사용자가 드로어를 기본적으로 항상 펼쳐진 상태로 요청해서(✕로 접을 수는 있음),
   본문이 드로어에 가리지 않도록 열려있을 때 오른쪽 여백을 확보한다 — 사용자 확정, 2026-09-23. */
.personal-work-shell {
  display: grid;
  grid-template-columns: 1fr 6fr;
  gap: 1rem;
  align-items: start;
  min-height: calc(100vh - 120px);
  padding-right: 0;
  transition: padding-right .2s ease;
}
.personal-work-shell.todo-open { padding-right: min(360px, 88vw); }
.personal-work-sidebar { display: flex; flex-direction: column; gap: .3rem; }
.personal-work-nav-btn {
  text-align: left; padding: .6rem .8rem; border-radius: 8px; border: none;
  background: none; color: var(--ink-muted); cursor: pointer; font-size: .92rem;
}
.personal-work-nav-btn.active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.personal-work-nav-btn:disabled { cursor: not-allowed; opacity: .5; }
.personal-work-content { min-width: 0; }
.personal-work-panel.hidden { display: none; }
.personal-work-todo {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 88vw);
  z-index: 50; transform: translateX(100%); transition: transform .2s ease;
  background: var(--surface); border-left: 1px solid var(--border);
  padding: .8rem; overflow-y: auto;
}
.personal-work-shell.todo-open .personal-work-todo { transform: translateX(0); }
.personal-work-todo-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.personal-work-todo-close { display: inline-block; }
.personal-work-todo-toggle {
  /* bottom: 4.5rem — 우측 하단 돋보기(.floating-zoombar, bottom:20px 근방)에 가려 눌리지
     않는 문제가 있어 그 위로 띄웠다. */
  display: block; position: fixed; right: 1rem; bottom: 4.5rem; z-index: 40;
  padding: .6rem 1rem; border-radius: 999px; border: none; background: var(--accent); color: var(--accent-ink);
  cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}

.task-overdue-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .74rem; background: #F4D9D5; color: #A6403F; }
.task-due-soon-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .74rem; background: var(--warn-bg); color: var(--warn-ink); }

.personal-work-todo-toolbar { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .6rem; }
.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; max-height: 55vh; overflow-y: auto; }
.todo-item { display: flex; align-items: flex-start; gap: .5rem; padding: .5rem; border: 1px solid var(--border); border-radius: 8px; cursor: grab; }
.todo-item-body { flex: 1; min-width: 0; }
.todo-item-title { font-size: .9rem; }
.todo-item-meta { font-size: .74rem; color: var(--ink-muted); display: flex; gap: .4rem; margin-top: .2rem; }

.design-cal-task-chip {
  font-size: .72rem; padding: 1px 4px; margin-top: 2px; border-radius: 4px;
  background: var(--surface-2); color: var(--ink); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; cursor: grab;
}
.design-cal-day.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }

/* ---------- 개인캘린더 주간/일간 뷰(칼럼형 업무 표) ---------- */
.cal-day-section { margin-bottom: 1.2rem; }
.cal-day-section-head { display: flex; align-items: center; justify-content: space-between; padding: .3rem .1rem; }
.cal-day-section-today strong { color: var(--accent); }
.cal-task-table td { vertical-align: top; }
#calTaskModalRoot .modal-inner label { margin-top: .5rem; }
#calDayBody tr.drag-over, .cal-task-table tbody tr.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
/* 날짜 범위 선택(월/주 뷰) — 그 위에 TODO를 끌어다 놓으면 이 범위가 작업기간이 된다 */
.cal-day-label { cursor: pointer; }
.design-cal-day.cal-range-selected { background: var(--accent-soft, var(--surface-2)); outline: 1px solid var(--accent); outline-offset: -1px; }
.cal-day-section.cal-range-selected .cal-day-section-head { background: var(--surface-2); outline: 1px solid var(--accent); outline-offset: -1px; }
.cal-day-section.drag-over, .table-scroll.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }

/* ---------- 일일업무보고서 ---------- */
#reportDropZone.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
#reportNavBar input[type="date"].report-date-today { font-weight: 700; background: var(--surface-2); }
