/* 사입 콘솔 (HEEHO GIFT SHOP) — 업무 1019-06 정리. 북마크 설치(/북마크)·받기 창도 같은 파일을 쓴다. */
:root {
  --bg: #f5f4f1; --card: #ffffff; --text: #1d1f23; --muted: #6a6f76; --line: #e2e0db; --line-2: #eeece8;
  --accent: #2b5fb4; --accent-2: #e8eefb; --accent-text: #ffffff;
  --ok: #1d7a3a; --ok-bg: #e4f5e8; --warn: #8d5b00; --warn-bg: #fdf1d8; --bad: #b42318; --bad-bg: #fdecea; --info: #2b5fb4; --info-bg: #e8eefb;
  --radius: 10px; --radius-s: 7px;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
.hidden { display: none !important; }

/* 맨 위 */
.top { max-width: 1120px; margin: 0 auto; padding: 28px 16px 6px; text-align: center; }
.brand { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: .14em; }
.top-btns { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.pill { display: inline-flex; align-items: center; padding: 6px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--text); font-size: 14px; text-decoration: none; cursor: pointer; font-family: inherit; line-height: 1.4; }
.pill:hover, .pill.on { border-color: var(--accent); color: var(--accent); background: var(--accent-2); }
.how { max-width: 640px; margin: 12px auto 0; padding: 12px 16px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; }
.how ol { margin: 0; padding-left: 20px; }
.how li { margin: 4px 0; }
.how p { margin: 8px 0 0; }
.meta-line { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.meta-line strong { color: var(--text); font-weight: 600; }
.status-bar { margin-top: 4px; font-size: 13px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; }
.status-bar:empty { display: none; }
.stale-banner { margin: 10px auto 0; max-width: 640px; padding: 10px 12px; border-radius: var(--radius-s); background: var(--warn-bg); border: 1px solid #edd39a; color: #5a4300; font-size: 14px; text-align: left; }

/* 공통 */
main { max-width: 1120px; margin: 0 auto; padding: 4px 16px 32px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 14px; }
.card h2 { margin: 0 0 12px; font-size: 17px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h2 .small { font-weight: 400; }
.card h2 > button { margin-left: auto; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.step { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 13px; align-items: center; justify-content: center; flex: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 0; }
input[type=url], input[type=text], input[type=number], input[type=password], select, textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); font-size: 15px; width: 100%; background: #fff; color: var(--text); font-family: inherit; min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=number] { text-align: right; }
input:disabled { background: #f4f3f0; color: var(--muted); }
select { width: auto; }
button { padding: 8px 14px; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: var(--radius-s); font-size: 14px; cursor: pointer; font-family: inherit; line-height: 1.3; }
button:hover { background: #f6f5f2; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.primary:hover { background: #224d93; }
button.ghost { color: var(--muted); }
button.small-btn, a.small-btn { padding: 4px 10px; font-size: 13px; }
a.small-btn { display: inline-block; border: 1px solid var(--line); border-radius: var(--radius-s); text-decoration: none; }
button:disabled { opacity: .55; cursor: default; }
label { font-size: 13px; color: var(--muted); }
label.inline { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; font-size: 14px; color: var(--text); }
input.short { width: 90px; }
.small { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.ok { color: var(--ok); }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0; }
.empty { color: var(--muted); font-size: 14px; padding: 14px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-s); margin: 8px 0; }
.status-line { font-size: 13px; }
.status-line:empty { display: none; }
.status-line.ok { color: var(--ok); } .status-line.bad { color: var(--bad); } .status-line.warn { color: var(--warn); } .status-line.info { color: var(--info); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: #efeeea; color: #444; border: 1px solid #e0ded8; white-space: nowrap; vertical-align: middle; }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: #bfe3c9; }
.badge-bad { background: var(--bad-bg); color: var(--bad); border-color: #f2c1bb; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: #efd8a6; }
.badge-info { background: var(--info-bg); color: var(--info); border-color: #c7d6f3; }
.chip { display: inline-block; padding: 2px 10px; margin: 2px 6px 2px 0; border: 1px solid #c7d6f3; border-radius: 999px; background: var(--info-bg); color: var(--info); font-size: 13px; }
code { background: #f1f0ec; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.notice { margin: 8px 0 0; padding: 8px 12px; background: var(--warn-bg); border: 1px solid #efd8a6; border-radius: var(--radius-s); color: #5c4400; font-size: 13px; }
.warnbox { margin: 6px 0; padding: 6px 10px; background: var(--warn-bg); border: 1px solid #efd8a6; border-radius: var(--radius-s); color: #5c4400; font-size: 13px; }
.out { background: #1e2228; color: #e6e6e6; padding: 10px 12px; border-radius: var(--radius-s); font-size: 12px; white-space: pre-wrap; word-break: break-all; max-height: 300px; overflow: auto; margin-top: 8px; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.foot { max-width: 1120px; margin: 0 auto; padding: 0 16px 24px; color: var(--muted); font-size: 12px; text-align: center; }

/* 1. 패키지 */
.create-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 100px auto; gap: 10px; align-items: end; padding: 12px; background: #faf9f6; border: 1px solid var(--line-2); border-radius: var(--radius); }
.create-row label { display: flex; flex-direction: column; gap: 4px; }
.create-row button { height: 40px; white-space: nowrap; }
#flowCreateStatus { margin-top: 6px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 12px; }
table.list th, table.list td { padding: 10px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; text-align: left; white-space: nowrap; }
table.list th { color: var(--muted); font-weight: 500; font-size: 12px; }
table.list td.num, table.list th.num { text-align: right; }
table.list td.strong { font-weight: 700; }
table.list td.wrap { white-space: normal; min-width: 140px; }
table.list td.act { text-align: right; }
table.list tbody tr.pkg { cursor: pointer; }
table.list tbody tr.pkg:hover td { background: #faf9f6; }
table.list tr.sel td { background: var(--accent-2) !important; }
table.list th.ph, table.list td.ph { width: 76px; text-align: center; }
.sub-amt { font-size: 11px; color: var(--muted); font-weight: 400; }
.pkg-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; margin: 0 auto; cursor: zoom-in; background: #fff; }
.photo-btn { white-space: nowrap; }
.req-wait { cursor: help; }
.req-note { font-size: 10px; color: var(--muted); line-height: 1.2; margin-top: 2px; }
#lowProfit { margin: 6px 0 0; }
#trashBox { margin-top: 12px; font-size: 14px; }
#trashBox summary { cursor: pointer; color: var(--muted); }
#trashBox table.list { margin-top: 4px; }
.selected-bar { position: sticky; top: 0; z-index: 5; margin-top: 14px; padding: 10px 14px; background: var(--accent-2); border: 1px solid #c7d6f3; border-radius: var(--radius); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-weight: 600; }

/* 2. 품목 */
.item-card { border: 1px solid var(--line); border-radius: var(--radius); margin: 10px 0; background: #fff; }
.item-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line-2); min-height: 52px; }
.item-head .fold { width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.item-card.folded .chev { transform: rotate(-45deg); }
.item-title { font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.item-head .ndel { flex: none; }
/* 접힌 줄(업무 1020-01): 썸네일 · 옵션 · 가격(≈원) · [− 개수 +]. 칸 어디를 눌러도 펼침 */
.fold-rows { display: none; }
.item-card.folded { cursor: pointer; }
.item-card.folded:hover { border-color: #c9c6bf; }
.item-card.folded .fold-rows { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-width: 0; }
.item-card.folded .item-title, .item-card.folded .ndel { display: none; }
.fold-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.fold-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: zoom-in; display: block; }
.fold-thumb.none { background: #f1f0ec; cursor: default; }
.fold-opt { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fold-price { font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.krw { color: var(--muted); font-size: 12px; white-space: nowrap; }
.item-card.folded .item-head { border-bottom: 0; }
.item-card.folded .item-body { display: none; }
.item-body { padding: 12px; }
.item-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.6fr) 110px; gap: 10px; align-items: start; }
.item-grid .cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13px; color: var(--muted); }
.lbl { font-size: 12px; color: var(--muted); }
.nlink-a { font-size: 13px; overflow-wrap: anywhere; padding: 8px 0; }
.nopt-view { min-height: 38px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: var(--radius-s); background: #faf9f6; color: var(--muted); font-size: 14px; line-height: 1.4; word-break: break-word; }
.nopt-view.picked { border-style: solid; border-color: #c7d6f3; background: var(--accent-2); color: var(--accent); font-weight: 600; }
.nopt-view.todo { color: var(--text); }
.nlink-status { margin-top: 6px; }
.opt-pick { margin-top: 10px; }
#flowPacks { margin: 8px 0; }
#flowPacks:empty { display: none; }
.pack-chip { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 2px 4px 2px 10px; margin: 2px 4px 2px 0; background: #fff; }
.calc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.calc-btn { min-width: 110px; position: relative; height: 40px; }
.calc-btn .dots { display: none; gap: 5px; align-items: center; justify-content: center; }
.calc-btn .dots i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: dot 1s infinite ease-in-out; }
.calc-btn .dots i:nth-child(2) { animation-delay: .15s; }
.calc-btn .dots i:nth-child(3) { animation-delay: .3s; }
.calc-btn.busy .btn-label { display: none; }
.calc-btn.busy .dots { display: inline-flex; }
.calc-btn.busy:disabled { opacity: .85; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .calc-btn .dots i { animation-duration: 2s; } }
button.busy { cursor: progress; }

/* 1688식 옵션 표 */
.sku-panel { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sku-top { display: flex; gap: 14px; align-items: flex-start; }
.sku-main { width: 110px; height: 110px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; overflow: hidden; flex: none; cursor: zoom-in; }
.sku-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sku-main.sku-noimg { display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); cursor: default; }
.sku-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sku-title { font-weight: 600; font-size: 14px; word-break: break-all; }
.sku-price { font-size: 20px; font-weight: 700; color: #c4410f; }
.sku-tiers { border-collapse: collapse; font-size: 12px; }
.sku-tiers th, .sku-tiers td { border: 1px solid var(--line); padding: 3px 8px; text-align: center; }
.sku-tiers th { background: #faf9f6; color: var(--muted); font-weight: 500; }
.sku-meta { word-break: break-all; }
.sku-gname { font-size: 13px; color: var(--muted); font-weight: 600; }
.sku-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.sku-chip-wrap { position: relative; display: inline-flex; align-items: stretch; max-width: 100%; }
.sku-chip { position: relative; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; font-size: 13px; max-width: 100%; flex: 1 1 auto; min-width: 0; }
.sku-chip:not(.has-img) { padding: 6px 10px; }
.sku-chip img { width: 46px; height: 46px; object-fit: cover; border-radius: 4px; flex: none; }
.sku-chip .sku-cv { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sku-chip.on { border-color: #ef6a12; color: #c4410f; box-shadow: 0 0 0 1px #ef6a12 inset; }
.sku-chip-wrap .sku-badge { position: absolute; top: -7px; right: -7px; pointer-events: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ef6a12; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.sku-chip img, .sku-main img, .sku-rv img { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sku-mag { display: none; flex: none; width: 32px; min-height: 32px; padding: 0; border: 1px solid var(--line); border-left: 0; border-radius: 0 var(--radius-s) var(--radius-s) 0; background: #faf9f6; color: var(--muted); align-items: center; justify-content: center; }
.sku-mag svg { display: block; }
@media (hover: none), (pointer: coarse), (max-width: 640px) {
  .sku-chip-wrap.has-mag .sku-chip { border-top-right-radius: 0; border-bottom-right-radius: 0; }
  .sku-chip-wrap.has-mag .sku-mag { display: inline-flex; }
}
.sku-table-wrap { overflow: auto; max-height: 380px; border: 1px solid var(--line-2); border-radius: var(--radius-s); }
.sku-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sku-table th, .sku-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
.sku-table th { color: var(--muted); font-weight: 500; background: #faf9f6; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.sku-table tr.on td { background: #fff6ea; }
.sku-table .sku-rv { word-break: break-all; }
.sku-table .sku-rv img { width: 32px; height: 32px; object-fit: cover; vertical-align: middle; border-radius: 3px; cursor: zoom-in; }
.pinput { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pinput .cur { color: var(--muted); font-size: 13px; }
.pinput input { width: 66px; padding: 4px 6px; font-size: 13px; text-align: right; }
.pinput.manual input { border-color: #e7b85a; background: #fff8e8; font-weight: 600; }
.sku-preset { padding: 2px 7px; font-size: 13px; color: var(--warn); border-color: #efd8a6; line-height: 1.3; }
.sku-preset.off, .sku-preset:disabled { color: var(--muted); border-color: var(--line); opacity: .35; }
/* 숫자 칸의 위아래 화살표(스피너)는 쓰지 않음(업무 1020-01) */
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.stepper button { padding: 2px 10px; border: 0; border-radius: 0; font-size: 16px; line-height: 1; background: #faf9f6; }
.stepper input { width: 46px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 0; padding: 4px; text-align: center; font-size: 14px; }
.stepper input:disabled { background: #f4f3f0; }
.c-qty .stepper { align-self: flex-start; }
.fc-courier { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; padding: 8px 10px; background: #faf9f6; border-radius: var(--radius-s); }
.sku-picked:empty { display: none; }
.sku-picked { font-size: 13px; }
.sku-picked ul { margin: 4px 0 0; padding-left: 18px; }
.sku-picked li { margin: 2px 0; word-break: break-all; }
.sku-zoom { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; }
.sku-zoom img { max-width: min(92vw, 520px); max-height: 80vh; width: 100%; object-fit: contain; background: #fff; border-radius: 8px; }
.sku-zoom .sku-zoom-close { background: #fff; }
/* 사진 크게 보기 창 */
.sku-pop { --pop: 240px; position: absolute; z-index: 60; width: calc(var(--pop) + 22px); padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0,0,0,.2); color: var(--text); }
.sku-pop.hover { pointer-events: none; }
.sku-pop.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 61; }
.sku-pop-img { width: var(--pop); height: var(--pop); border-radius: 6px; background: #fff; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.sku-pop-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sku-pop-img.sku-pop-none { background: #f1f0ec; color: var(--muted); font-size: 14px; text-align: center; padding: 16px; }
.sku-pop-cap { margin-top: 8px; min-width: 0; }
.sku-pop-g { font-size: 12px; color: var(--muted); }
.sku-pop-v { font-size: 14px; font-weight: 600; word-break: break-all; }
.sku-pop-px { font-size: 11px; color: var(--muted); }
.sku-pop-px:empty { display: none; }
.sku-pop-close { display: none; width: 100%; margin-top: 8px; min-height: 40px; }
.sku-pop.modal .sku-pop-close { display: block; }
.sku-pop-back { position: fixed; inset: 0; z-index: 59; background: rgba(0,0,0,.45); }
/* 국내 도매 사진검색 */
.lens-box { margin-top: 10px; padding: 8px 10px; background: #faf9f6; border-radius: var(--radius-s); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.lens-search { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lens-label { font-weight: 600; font-size: 12px; color: var(--muted); margin-right: 2px; }
.lens-pick:empty { display: none; }
.lens-form .row { align-items: flex-end; }
.lens-form label { display: flex; flex-direction: column; gap: 3px; }
.lens-form label.grow { flex: 1 1 240px; }
.lens-form label.inline { flex-direction: row; }
img.img-fail { visibility: hidden; }

/* 3. 결과 */
.price-hero { border: 1px solid #c7d6f3; background: #f6f9ff; border-radius: var(--radius); padding: 14px 16px; }
.hero-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.hero-label { font-weight: 700; font-size: 15px; }
.hero-basis { font-size: 12px; color: var(--muted); }
.hero-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hero-num { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.hero-num .t { font-size: 13px; color: var(--muted); }
.hero-num .v { font-size: 28px; font-weight: 800; line-height: 1.2; margin-top: 2px; overflow-wrap: anywhere; letter-spacing: -.01em; }
.hero-num .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hero-num.rec { border-color: var(--accent); }
.hero-num.rec .v { color: var(--accent); }
.hero-foot { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.forecast { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.fc-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.fc-grid label { display: flex; flex-direction: column; gap: 4px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 10px 0 4px; }
.sum-card { padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: #faf9f6; min-width: 0; }
.sum-card .t { font-size: 12px; color: var(--muted); }
.sum-card .v { font-size: 17px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.sum-card .d { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sum-card .d:empty { display: none; }
.sum-card.neg .v { color: var(--bad); }
details.formula { font-size: 13px; margin-top: 6px; }
details.formula summary, details.calc-detail > summary, details.bd-list > summary { cursor: pointer; }
details.formula ul { margin: 6px 0; padding-left: 18px; color: var(--muted); }
details.calc-detail { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
details.calc-detail > summary { padding: 12px 14px; font-weight: 600; font-size: 15px; }
details.calc-detail[open] > summary { border-bottom: 1px solid var(--line-2); }
details.calc-detail > .sub-card, details.calc-detail > p { margin-left: 14px; margin-right: 14px; }
.sub-card { border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 12px 14px; margin-top: 12px; background: #fff; }
.sub-card h4 { margin: 0 0 8px; font-size: 14px; }
.bd-picked { font-size: 14px; }
details.bd-list { margin-top: 8px; font-size: 14px; }
details.bd-list > summary { color: var(--accent); font-size: 13px; padding: 2px 0; }
.bd-rows { margin-top: 6px; border-top: 1px solid var(--line-2); }
.bd-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 130px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.bd-l { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; min-width: 0; cursor: pointer; }
.bd-l input { width: 18px; height: 18px; flex: none; margin: 0; }
.bd-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bd-a { font-size: 13px; color: var(--muted); white-space: nowrap; text-align: right; }
.bd-amt { padding: 5px 8px; font-size: 13px; }
.direct-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.direct-grid label { display: flex; flex-direction: column; gap: 4px; }
table.lines { width: 100%; border-collapse: collapse; font-size: 14px; }
table.lines td { padding: 6px 4px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.lines td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.lines .calc, .sub-card .calc { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
table.lines tr.total td { font-weight: 700; border-bottom: 0; padding-top: 8px; }
ul.plain { margin: 0; padding-left: 18px; font-size: 13px; }
ul.plain li { margin: 2px 0; }
details.calc-detail > p.small { margin-top: 12px; margin-bottom: 12px; }

/* 북마크 설치·받기 창 */
.top .ver, .ver { font-size: 12px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
a.bm-btn { display: inline-block; padding: 10px 18px; background: var(--accent); color: var(--accent-text); border-radius: 8px; font-weight: 700; text-decoration: none; cursor: grab; }
.bm-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
ol.bm-steps { padding-left: 20px; }
ol.bm-steps li { margin: 6px 0; line-height: 1.55; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 12px; background: #fff; }
#bmCode { font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
.page-sub .top { text-align: left; }
.page-sub .top h1 { font-size: 22px; margin: 0; }
.pkg-pick { border: 1px solid #c7d6f3; background: #f6f9ff; border-radius: var(--radius-s); padding: 10px 12px; margin: 10px 0; }
.pkg-pick h3 { margin: 0 0 6px; font-size: 15px; }
.pkg-pick select { min-width: 260px; max-width: 100%; padding: 8px; font-size: 15px; }
#rcvSummary.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; margin: 6px 0 10px; }
#rcvSummary.kv .k { color: var(--muted); white-space: nowrap; }
#rcvSummary.kv > span { overflow-wrap: anywhere; }

/* 좁은 화면 */
@media (max-width: 860px) {
  .create-row { grid-template-columns: 140px minmax(0, 1fr) 90px; }
  .create-row button { grid-column: 1 / -1; }
  .item-grid { grid-template-columns: minmax(0, 1fr) 110px; }
  .item-grid .nopt-cell { grid-column: 1 / -1; order: 3; }
  .fc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .top { padding-top: 20px; }
  .brand { font-size: 22px; }
  .card { padding: 14px 12px; }
  .create-row { grid-template-columns: 1fr 90px; padding: 10px; }
  .create-row .f-id { grid-column: 1 / -1; }
  table.list .c-st, table.list .c-n { display: none; }
  /* 패키지 표: 휴대폰에서는 줄마다 카드처럼(가로 스크롤 없이) */
  #pkgTable thead { display: none; }
  #pkgTable, #pkgTable tbody { display: block; }
  #pkgTable tr.pkg { display: grid; grid-template-columns: 26px 54px minmax(0, 1fr) auto; column-gap: 8px; padding: 10px 2px; border-bottom: 1px solid var(--line-2); }
  #pkgTable tr.pkg td.chk { grid-row: 1 / span 3; grid-column: 1; width: auto; padding-top: 8px; }
  #pkgTable tr.pkg td { display: block; border: 0; padding: 0; white-space: normal; min-width: 0; }
  #pkgTable tr.pkg td.ph { grid-row: 1 / span 3; grid-column: 2; width: auto; }
  #pkgTable tr.pkg td.pid { grid-column: 3; grid-row: 1; font-size: 13px; }
  #pkgTable tr.pkg td.act { grid-column: 4; grid-row: 1; }
  #pkgTable tr.pkg td.wrap { grid-column: 3 / span 2; grid-row: 2; min-width: 0; margin: 2px 0 4px; }
  #pkgTable tr.pkg td.c-cost { grid-column: 3; grid-row: 3; text-align: left; }
  #pkgTable tr.pkg td.c-rec { grid-column: 4; grid-row: 3; text-align: right; }
  #pkgTable tr.pkg td.c-rec::before { content: "추천 "; font-size: 11px; font-weight: 400; color: var(--muted); }
  #pkgTable tr.pkg td.c-cost::before { content: "원가 "; font-size: 11px; color: var(--muted); }
  #pkgTable tr.pkg .sub-amt { display: block; }
  #pkgTable td[colspan] { display: block; padding: 10px 0; }
  #pkgTable tr.pkg td.c-st, #pkgTable tr.pkg td.c-n { display: none; }
  #pkgTable tr.pkg.sel { background: var(--accent-2); border-radius: 8px; }
  #pkgTable tr.pkg.sel td, #pkgTable tr.pkg:hover td { background: transparent !important; }
  table.list th, table.list td { padding: 8px 5px; }
  table.list td.wrap { min-width: 96px; }
  table.list th.ph, table.list td.ph { width: 58px; }
  .pkg-thumb { width: 38px; height: 38px; }
  .photo-btn { padding: 3px 2px; font-size: 11px; width: 46px; white-space: normal; line-height: 1.25; }
  .req-wait { font-size: 10px; padding: 1px 4px; }
  .item-head { padding: 8px; gap: 8px; }
  .item-head .ndel { padding: 3px 8px; font-size: 12px; }
  .item-body { padding: 10px; }
  .sku-top { gap: 10px; }
  .sku-main { width: 84px; height: 84px; }
  .sku-price { font-size: 17px; }
  .sku-tiers { font-size: 11px; }
  .sku-tiers th, .sku-tiers td { padding: 2px 4px; white-space: nowrap; }
  .sku-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sku-chip { gap: 4px; font-size: 12px; }
  .sku-chip-wrap { min-width: 0; }
  .sku-chip img { width: 36px; height: 36px; }
  .sku-table th, .sku-table td { padding: 5px 4px; }
  .sku-table .c-stock { display: none; }
  .pinput input { width: 64px; }
  .stepper button { padding: 2px 8px; }
  .stepper input { width: 38px; }
  .fold-row { grid-template-columns: 36px minmax(0, 1fr) auto; row-gap: 4px; }
  .fold-thumb { width: 36px; height: 36px; }
  .fold-row .stepper { grid-column: 2 / span 2; justify-self: end; }
  .pinput .krw { flex-basis: 100%; }
  .hero-nums { grid-template-columns: 1fr; }
  .hero-num { display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: 8px; padding: 10px 12px; }
  .hero-num .v { font-size: 22px; grid-row: 1 / span 2; grid-column: 2; text-align: right; }
  .fc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .direct-grid { grid-template-columns: 1fr; }
  .bd-row { grid-template-columns: minmax(0, 1fr) 104px; }
  .bd-a { grid-column: 1; grid-row: 2; text-align: left; padding-left: 26px; }
  .bd-amt { grid-column: 2; grid-row: 1 / span 2; }
  details.calc-detail > .sub-card, details.calc-detail > p { margin-left: 10px; margin-right: 10px; }
  .selected-bar { position: static; }
  .pkg-pick select { min-width: 0; width: 100%; }
}

/* 업무 1020-01c(사용자 "포장재, 품목 제목 색상 다르게"): 카드 모양은 같고 제목 줄 색만 다름. 일반 품목 = 파란 줄, 포장재 = 호박색 줄 */
:root { --item-head-bg: #edf2fb; --item-head-fg: #1d3b6e; --item-head-line: #c9d6ee;
        --pack-head-bg: #fbefd9; --pack-head-fg: #6a4200; --pack-head-line: #ecd2a0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --item-head-bg: #1f3352; --item-head-fg: #dce8ff; --item-head-line: #34507c;
                                    --pack-head-bg: #4a3512; --pack-head-fg: #ffe2b0; --pack-head-line: #6e5226; }
}
:root[data-theme="dark"] { --item-head-bg: #1f3352; --item-head-fg: #dce8ff; --item-head-line: #34507c;
                           --pack-head-bg: #4a3512; --pack-head-fg: #ffe2b0; --pack-head-line: #6e5226; }
.flow-card > .item-head, .pack-card > .item-head { border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
.flow-card > .item-head { background: var(--item-head-bg); color: var(--item-head-fg); border-bottom-color: var(--item-head-line); }
.pack-card > .item-head { background: var(--pack-head-bg); color: var(--pack-head-fg); border-bottom-color: var(--pack-head-line); }
.item-card.folded > .item-head { border-radius: calc(var(--radius) - 1px); }
.flow-card > .item-head .fold { background: transparent; border-color: var(--item-head-line); color: inherit; }
.pack-card > .item-head .fold { background: transparent; border-color: var(--pack-head-line); color: inherit; }
.flow-card > .item-head .chev, .pack-card > .item-head .chev { border-color: currentColor; }
.flow-card > .item-head .fold-price .krw, .pack-card > .item-head .fold-price .krw { color: inherit; opacity: .8; }
.pack-card .pack-link-row { display: flex; gap: 6px; align-items: center; }
.pack-card .pack-link-row input { flex: 1 1 auto; }
.pack-card .pack-link-row a.small-btn { flex: 0 0 auto; padding: 8px 12px; background: #fff; }
.pack-card .gprice { text-align: right; }
.pack-card .pack-foot { margin-top: 10px; }

/* 업무 1020-01c: 1번 목록 체크박스 + 사입시트 내려받기, 3번 원가 아래 택배비 칸 */
table.list th.chk, table.list td.chk { width: 34px; text-align: center; cursor: default; }
table.list td.chk input, #pkgAll { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--accent); }
.sheet-dl-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 6px; }
.sheet-dl-row label.inline { display: inline-flex; align-items: center; gap: 6px; }
#sheetDlBtn:disabled { opacity: .45; cursor: not-allowed; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.c-cost .sub-amt { display: block; font-size: 11px; font-weight: 400; }
.courier-edit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding: 8px 10px; background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius-s); font-size: 13px; }
.courier-edit label.inline { display: inline-flex; align-items: center; gap: 6px; }
.courier-edit input.short { width: 90px; text-align: right; }

/* 업무 1020-01c: 1688 포장재 카드(품목 카드와 같음, 세트당 1개 고정 · 국내 도매 사진검색 없음), 직접 입력 카드의 '1개' */
.pack-card .pack-one { font-size: 13px; font-weight: 600; white-space: nowrap; padding: 4px 0; }
.pack-1688 .c-qty .stepper, .pack-1688 .fold-row .stepper { display: none; }
.pack-1688 .c-qty::after { content: "1개(고정)"; font-size: 13px; font-weight: 600; color: var(--text); }
.pack-1688 .fold-row::after { content: "1개"; font-size: 13px; font-weight: 600; }
.pack-1688 .nsim { display: none !important; }
/* 국내 도매 칸: 사진검색 버튼과 [고른 상품 넣기]를 한 줄로, 넣기 칸들도 한 줄로(좁으면 줄바꿈, 가로 스크롤 없음) */
.lens-box { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 10px; }
.lens-box .lens-search { flex: 0 1 auto; }
.lens-box .lens-pick { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.lens-box .lens-pick:has(.lens-form) { flex-basis: 100%; }
.lens-form { width: 100%; }
.lens-form .row { flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.lens-form label { min-width: 0; }
.lens-form label.grow { flex: 1 1 260px; }
.lens-form input.short { width: 96px; }
/* 맨 위 도매꾹 키 */
.dm-state { margin-left: 4px; font-size: 12px; font-weight: 600; }
.dm-state.on { color: var(--ok); }
.dm-state.off { color: var(--muted); }
#dmKeyBox .row label.inline { display: inline-flex; align-items: center; gap: 6px; }
#dmKeyBox input { width: 240px; max-width: 100%; }
@media (max-width: 600px) {
  .lens-form label.grow { flex-basis: 100%; }
  #dmKeyBox input { width: 100%; }
  .top-btns { flex-wrap: wrap; }
}

/* 휴지통 완전 삭제(업무 1021-03) */
.trash-tools { gap: 10px; align-items: center; margin: 6px 0; }
button.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
button.ghost.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
button.danger:disabled { opacity: .45; cursor: not-allowed; }
#purgeDlg { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); padding: 18px 20px; max-width: min(520px, calc(100vw - 32px)); }
#purgeDlg::backdrop { background: rgba(0, 0, 0, .35); }
#purgeDlg h3 { margin: 0 0 8px; }
#purgeList { max-height: 40vh; overflow: auto; padding-left: 18px; }
#purgeDlg .row { justify-content: flex-end; gap: 8px; }

/* 참고사진 바로 만들기(업무 1021-02) */
.photo-dlg { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); padding: 16px 18px; width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.photo-dlg::backdrop { background: rgba(0, 0, 0, .35); }
.photo-dlg h3 { margin: 0 0 6px; }
.photo-steps { padding-left: 20px; }
.photo-steps li { margin: 10px 0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.photo-cell { position: relative; margin: 0; text-align: center; font-size: 12px; color: #222; }
.photo-cell img, .photo-none { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #f6f6f6; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.photo-no { position: absolute; top: 4px; left: 4px; background: #111; color: #fff; font-weight: 700; font-size: 16px; min-width: 26px; height: 26px; line-height: 26px; border-radius: 13px; }
.photo-steps textarea { width: 100%; font-size: 12px; margin-top: 6px; }
.photo-preview img { max-width: 100%; max-height: 50vh; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; }
.photo-checks .check-row { display: block; padding: 3px 0; }
.photo-foot { gap: 8px; flex-wrap: wrap; }
.photo-now { margin-top: 4px; }

/* 업무 1021-01b: 배대지 청구액 칸([계산] 오른쪽), [바로 만들기] 기본·Claude 요청은 작은 링크 */
.bill-in input { width: 9.5em; max-width: 100%; }
.bill-hint { flex-basis: auto; }
@media (max-width: 480px) { .bill-in { flex: 1 1 100%; } .bill-in input { width: 100%; } }
.link-btn { background: none; border: 0; padding: 2px 0; color: var(--info); text-decoration: underline; cursor: pointer; font: inherit; }
.link-btn.small { font-size: 12px; }
td.ph .photo-now { display: block; margin: 0 auto 2px; }
td.ph .req-note { font-size: 11px; }
td.ph .photo-now { white-space: nowrap; }
td.ph .photo-btn { white-space: nowrap; font-size: 11px; width: auto; }
/* 휴대폰: 사진이 없는 줄은 [바로 만들기]를 사진 칸 대신 카드 맨 아래 줄에 가로로(좁은 사진 칸에서 세 줄로 꺾이지 않게) */
@media (max-width: 640px) {
  #pkgTable tr.pkg td.ph.ph-make { grid-row: 4; grid-column: 3 / span 2; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 6px; text-align: left; }
  #pkgTable tr.pkg td.ph.ph-make .photo-now { display: inline-block; margin: 0; width: auto; }
  #pkgTable tr.pkg td.ph.ph-make .photo-btn, #pkgTable tr.pkg td.ph.ph-make .req-note { width: auto; }
}

/* 업무 1021-04: 번호표 #0 포장재 · 포장재 사진 올리기 · 포장재 없음 안내 */
.photo-cell.pack0 { outline: 2px solid var(--warn); outline-offset: 2px; border-radius: 6px; }
.photo-cell .kind-sel select { font-size: 12px; }
.photo-plain { margin: 6px 0; color: var(--warn); }
.pack-up { margin: 8px 0; padding: 10px; border: 1px dashed var(--warn); border-radius: 8px; background: var(--warn-bg); font-size: 13px; }
.paste-zone { margin-top: 6px; padding: 10px; border: 1px dashed var(--line); border-radius: 6px; background: var(--card); color: var(--muted); min-height: 1.5em; }
.photo-checks .pack-check { font-weight: 600; }
@media (max-width: 480px) { .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 업무 1021-07: 받는 창 — 담을 패키지를 크게 */
.pkg-now { margin: 6px 0 8px; padding: 10px 12px; border-radius: 8px; background: var(--info-bg); border: 1px solid #c7d6f3; font-size: 15px; }
.pkg-now .pid { color: var(--muted); font-weight: 600; }
