:root {
  --bg: #faf8f5; --card: #fff; --ink: #1d1d1f; --muted: #77757a; --line: #e8e4de;
  --accent: #d6336c; --accent-ink: #fff; --soft: #f3efe9; --ok: #2b8a3e; --warn: #b25e09; --err: #c92a2a;
  --r: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 16px; line-height: 1.5; word-break: keep-all;
}
body.noscroll { overflow: hidden; }
#root { max-width: 960px; margin: 0 auto; padding: 0 16px 110px; }
h1 { font-size: 22px; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); font-weight: 600; }
p { margin: 6px 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.error { color: var(--err); } .warn { color: var(--warn); }
.loading, .empty { text-align: center; color: var(--muted); padding: 60px 0; grid-column: 1 / -1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.scroll-x { display: flex; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.scroll-x::-webkit-scrollbar { display: none; }

/* 버튼·입력 */
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 16px; font-weight: 600; white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger, .link.danger { color: var(--err); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.link { background: none; border: 0; padding: 4px 2px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
a.link { display: inline-block; }
input:not([type=checkbox]):not([type=file]), select, textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; width: 100%; min-width: 0;
}
input.narrow { width: 120px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* 코드 입력 */
.gate { max-width: 360px; margin: 14vh auto 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px; display: flex; flex-direction: column; gap: 12px; }
.gate.wide { max-width: 420px; margin-top: 6vh; }
.gate label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.gate label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--ink); font-weight: 400; }
.gate label.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.gate .link.center { align-self: center; }
.code-input { text-align: center; font-size: 22px !important; letter-spacing: 0.2em; font-weight: 700; text-transform: uppercase; }
.demo-note { background: var(--soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--muted); }

/* 상단 */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 20px 0 12px; }
.notice { background: #fff4e6; border: 1px solid #ffd8a8; color: #7a4b00; border-radius: 12px; padding: 10px 14px; font-size: 14px; white-space: pre-line; }
.filters { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0 12px; display: flex; flex-direction: column; gap: 10px; }
.chips { gap: 8px; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 16px; font-weight: 600; white-space: nowrap; }
.chip small { font-weight: 400; color: var(--muted); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.on small { color: #ccc; }

/* 상품 카드 */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { text-align: left; padding: 0; border: 1px solid var(--line); background: var(--card); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.thumb { position: relative; flex: none; width: 100%; aspect-ratio: 4 / 5; background: var(--soft); overflow: hidden; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.card.soldout .thumb img { opacity: 0.45; }
.badge { position: absolute; left: 8px; top: 8px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 8px; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 1px; }
.brand { font-size: 12px; color: var(--muted); }
.name { font-size: 15px; line-height: 1.3; }
.price { color: var(--accent); font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.jr { font-size: 13px; color: var(--accent); font-weight: 600; }
.retail { font-size: 12px; color: var(--muted); }

/* 주문함 버튼 */
.cart-fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 8; background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 14px 22px; font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,.2); display: flex; gap: 8px; align-items: center; }
.count { background: var(--accent); border-radius: 999px; min-width: 22px; padding: 0 6px; font-size: 13px; line-height: 22px; text-align: center; }

/* 아래에서 올라오는 창 */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92dvh; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; }
@media (min-width: 640px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 20px; max-height: 88dvh; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.x { border: 0; background: none; font-size: 18px; padding: 4px 8px; }
.sheet-body { overflow-y: auto; padding-bottom: 16px; }
.sheet-body > h3, .sheet-body > p, .sheet-body > pre, .sheet-body > .total { margin-left: 16px; margin-right: 16px; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.gallery { gap: 4px; scroll-snap-type: x mandatory; background: var(--soft); }
.gallery img { flex: none; width: 72%; aspect-ratio: 4 / 5; object-fit: cover; scroll-snap-align: center; }
.gallery img:only-child { width: 100%; }
.noimg { padding: 60px; color: var(--muted); margin: 0 auto; }
.detail { padding: 12px 16px 0; }
.detail h2 { font-size: 20px; margin: 0 0 8px; }
.price-table { width: 100%; border-collapse: collapse; }
.price-table th { text-align: left; font-weight: 600; font-size: 14px; padding: 6px 0; }
.price-table td { text-align: right; padding: 6px 0 6px 10px; white-space: nowrap; }
.price-table tr + tr { border-top: 1px solid var(--line); }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 14px; font-weight: 600; min-width: 48px; }
.opt.on { border-color: var(--accent); background: #fff0f5; color: var(--accent); }
.qty { display: flex; align-items: center; gap: 12px; }
.step { border: 1px solid var(--line); background: #fff; border-radius: 10px; min-width: 42px; height: 42px; font-size: 18px; font-weight: 600; }
.qty-num { min-width: 24px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.sum { margin-left: auto; font-size: 18px; }
.qty.compact { gap: 6px; } .qty.compact .step { min-width: 34px; height: 34px; font-size: 14px; padding: 0 8px; }

/* 주문함 */
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.lines li.bad { opacity: 0.6; }
.line-img { width: 56px; height: 70px; object-fit: cover; border-radius: 8px; background: var(--soft); flex: none; }
.line-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 0; }
.total strong { font-size: 22px; color: var(--accent); }
.order-text { background: var(--soft); border-radius: 12px; padding: 12px 14px; font: inherit; font-size: 14px; white-space: pre-wrap; user-select: all; }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: rgba(29,29,31,.94); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 관리자 */
.tabs { gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { flex: none; border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.panel.attention { border-color: var(--accent); }
details.panel { display: block; } details.panel summary { cursor: pointer; font-weight: 600; } details.panel .table-wrap { margin-top: 10px; }
.panel .orders { width: 100%; }
.panel.ok { border-color: #b2f2bb; background: #f4fcf5; }
.panel label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); width: 100%; }
.panel label.check, .prow label.check { flex-direction: row; align-items: center; width: auto; gap: 6px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; width: 100%; }
.form-row label { width: auto; }
progress { flex: 1; height: 10px; accent-color: var(--accent); }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; }
.data th, .data td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.data th { background: var(--soft); font-size: 12px; color: var(--muted); }
.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.data .price { font-size: 14px; }
.data .code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: 0.05em; }
.data .actions { display: flex; gap: 10px; }
.dim { opacity: 0.55; }
.plist { display: flex; flex-direction: column; gap: 10px; }
.prow { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.prow-main { display: flex; gap: 12px; }
.prow-img { width: 64px; height: 80px; object-fit: cover; border-radius: 8px; background: var(--soft); flex: none; }
.prow-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prow-info .price { font-size: 14px; }
.prow-ctl { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.prow-ctl label { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; gap: 3px; }
.tag { margin-left: 6px; font-size: 11px; background: var(--soft); border-radius: 6px; padding: 1px 6px; color: var(--muted); }
.tag.guard { background: #fff4e6; color: #b25e09; border: 1px solid #ffd8a8; font-weight: 700; margin-left: 0; align-self: flex-start; }
.data .tag.guard { margin-left: 6px; }
.pics { gap: 6px; }
.pic { flex: none; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: none; }
.pic.on { border-color: var(--accent); }
.pic img { width: 72px; height: 90px; object-fit: cover; display: block; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.top-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.my-orders { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 0; }
.my-order { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.my-order .order-head, .my-order .steps, .my-order .my-lines, .my-order .total, .my-order .notice { width: 100%; }
.my-order .notice { margin: 0; }
.pay-box { width: 100%; background: var(--soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.pay-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.pay-acct { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pay-acct strong { font-size: 17px; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; user-select: all; }
.pay-holder { font-size: 14px; }
.pay-note { margin: 4px 0 0; font-size: 13px; color: var(--accent); font-weight: 600; white-space: pre-line; }
.detail .pay-box { margin-top: 10px; }
.status-badge { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.status-badge.s-unpaid { background: #fff9db; color: #8f6400; }
.status-badge.s-paid { background: #e7f5ff; color: #1864ab; }
.status-badge.s-placed { background: #fff4e6; color: #b25e09; }
.status-badge.s-shipped { background: #ebfbee; color: var(--ok); }
.steps { list-style: none; display: flex; margin: 0; padding: 0; gap: 4px; }
.steps li { flex: 1; text-align: center; font-size: 11px; white-space: nowrap; letter-spacing: -0.03em; color: var(--muted); padding-top: 8px; border-top: 3px solid var(--line); }
.steps li.done { color: var(--ink); font-weight: 700; border-top-color: var(--accent); }
.my-lines { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.my-lines li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.my-lines li:last-child { border-bottom: 0; }
.line-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.st { flex: none; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px; background: var(--soft); color: var(--muted); margin-left: 6px; white-space: nowrap; }
.st.st-wait { background: #fff4e6; color: #b25e09; }
.st.st-in { background: #e7f5ff; color: #1864ab; }
.st.st-shipped { background: #ebfbee; color: var(--ok); }
.order-lines { list-style: none; margin: 0; padding: 0; width: 100%; font-size: 14px; }
.order-lines li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.order-lines li .grow { min-width: 200px; }
.order-lines select { width: auto; padding: 5px 8px; font-size: 13px; }
.order .ship-box, .order .note-box { background: var(--soft); border-radius: 10px; padding: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.order .ship-box select, .order .ship-box input { width: auto; }
.order .note-box textarea { flex: 1; min-width: 220px; }
.early-box { background: #fff0f5; border: 1px solid var(--accent); border-radius: 10px; padding: 10px; font-size: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.total.sub { padding-top: 10px; color: var(--muted); font-size: 14px; }
.form { padding: 14px 16px 0; display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.form label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--ink); }
.form label.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.consent-text { font-size: 12px; margin: 0; max-height: 150px; overflow-y: auto; user-select: text; }
.orders { display: flex; flex-direction: column; gap: 12px; }
.order { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.order.new { border-color: var(--accent); }
.order-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-head select { width: auto; }
.order dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 14px; }
.order dt { color: var(--muted); } .order dd { margin: 0; }
.order ol { margin: 0; padding-left: 20px; font-size: 14px; }
.consent-log { background: var(--soft); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.tab .count { margin-left: 6px; color: #fff; display: inline-block; }
.tiers { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.tier { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--soft); border-radius: 10px; padding: 8px 10px; }
.tier input.narrow { width: 100px; }
.tier-label { min-width: 180px; }
.opt.small { padding: 5px 10px; font-size: 13px; min-width: 0; }
[hidden] { display: none !important; }
