:root {
  --bg: #fff;
  --fg: #141414;
  --muted: #737373;
  --line: #e7e7e7;
  --soft: #f5f5f5;
  --accent: #141414;
  --new: #d93025;
  --ok: #1a7f37;
  --warn: #b26a00;
  --radius: 12px;
  --top-h: 0px;
  --nav-h: 58px;
  --font: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 150px; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font);
  font-size: 15px; line-height: 1.45; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- 상단 ---------- */
.top {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  border-bottom: 1px solid var(--line); padding: env(safe-area-inset-top) 0 0;
}
.top-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 4px; gap: 8px; }
.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1; }
.brand-name { font-family: "Adobe Myungjo Std M", "Noto Sans KR", serif; font-weight: 700; font-size: 18px; letter-spacing: .5px; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.btn-order-top {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border: 0; flex: 0 0 auto;
  border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 14px; min-height: 38px; white-space: nowrap;
}
.top-nav { display: none; }
@media (min-width: 960px) {
  .top-nav { display: flex; gap: 2px; margin-right: 10px; }
  .top-nav a { padding: 8px 12px; border-radius: 8px; font-size: 14px; color: var(--muted); }
  .top-nav a:hover { color: var(--fg); }
  .top-nav a.active { color: var(--fg); background: var(--soft); font-weight: 700; }
}
.user-box { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.user-box:empty { display: none; }
.btn-text { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 0 12px; font-size: 13px; min-height: 36px; white-space: nowrap; }
.btn-text.btn-login { font-weight: 700; border-color: var(--fg); }
.btn-text.btn-admin { background: var(--fg); color: #fff; border-color: var(--fg); font-weight: 700; display: inline-flex; align-items: center; }
.top-nav .nav-admin { color: var(--new); font-weight: 700; }
@media (min-width: 960px) { .user-box .btn-admin { display: none; } }   /* PC 는 위 메뉴의 '관리자' 링크로 */
.user-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; max-width: 120px; min-height: 36px; }
.user-chip .user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: #bbb; }
.st-dot.st-approved { background: var(--ok); } .st-dot.st-pending { background: var(--warn); }
@media (max-width: 400px) { .user-chip { max-width: 80px; } .btn-text { padding: 0 9px; font-size: 12px; } }
.badge-count { background: var(--new); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; }
.badge-count:empty, .badge-count[data-zero] { display: none; }
.search-row { padding: 4px 16px 6px; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--soft); border-radius: 10px; padding: 0 12px; height: 42px; color: var(--muted); }
.search-box input { flex: 1; border: 0; background: transparent; outline: none; height: 100%; font-size: 16px; color: var(--fg); min-width: 0; }
.search-box input::-webkit-search-cancel-button { display: none; }
#search-clear { border: 0; background: #ddd; color: #333; width: 24px; height: 24px; border-radius: 50%; font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 7px 13px; font-size: 13px; white-space: nowrap; min-height: 36px; }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip small { color: inherit; opacity: .6; margin-left: 3px; }

/* ---------- 목록 ---------- */
#main { min-height: 60vh; }
.view { padding: 0 16px 24px; }
.list-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0 4px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.list-tools label { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.list-tools input[type=checkbox] { width: 18px; height: 18px; }
.cat-section { padding-top: 8px; }
.cat-head {
  position: sticky; top: var(--top-h); z-index: 5; background: var(--bg);
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 12px 0 8px; border-bottom: 2px solid var(--fg); margin-bottom: 12px;
}
.cat-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.cat-head .en { font-size: 12px; color: var(--muted); letter-spacing: .5px; margin-left: 8px; }
.cat-head .cnt { font-size: 13px; color: var(--muted); white-space: nowrap; }
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } .view { padding: 0 24px 32px; } }
@media (min-width: 1400px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg);
  display: flex; flex-direction: column; cursor: pointer; position: relative;
}
.card:active { transform: scale(.995); }
.card-img { background: #f3f3f3; position: relative; }
.card-img img { width: 100%; height: auto; aspect-ratio: auto 524 / 273; object-fit: contain; }  /* 로드 전에는 예상 비율로 자리를 잡고, 로드 후엔 실제 비율 */
.badge { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; color: #fff; background: var(--new); letter-spacing: .3px; }
.badge.disc { background: #8a8a8a; }
.badge.soldout { background: var(--warn); }
.card-body { padding: 10px 12px 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; }
.card-code { font-weight: 700; font-size: 16px; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.pc { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 5px; background: #dedede; color: #222; font-size: 12px; font-weight: 700; }
.card-name { grid-column: 1 / -1; font-size: 15px; }
.card-name .en { color: var(--muted); font-size: 12px; margin-left: 6px; }
.card-meta { grid-column: 1; font-size: 12px; color: var(--muted); }
.card-cart { grid-column: 2; grid-row: 1 / span 3; align-self: start; font-size: 12px; font-weight: 700; color: var(--ok); background: #e9f6ec; border-radius: 6px; padding: 3px 8px; }
.card-cart:empty { display: none; }
.card.disc { opacity: .6; }
.empty { padding: 48px 0; text-align: center; color: var(--muted); }
.result-note { font-size: 13px; color: var(--muted); padding: 10px 0 2px; }

/* ---------- 하단 내비 ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--bg); border-top: 1px solid var(--line);
  display: flex; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--muted); position: relative; }
.bottom-nav a .ico { font-size: 18px; line-height: 1; }
.bottom-nav a.active { color: var(--fg); font-weight: 700; }
.bottom-nav .badge-count { position: absolute; top: 6px; left: calc(50% + 6px); }
@media (min-width: 960px) {
  body { padding-bottom: 24px; }
  .bottom-nav { position: sticky; top: 0; height: auto; border: 0; justify-content: flex-end; gap: 4px; padding: 0 24px; display: none; }
}

/* ---------- 제품 시트 ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 94dvh; background: var(--bg);
  border-radius: 18px 18px 0 0; display: flex; flex-direction: column; box-shadow: 0 -8px 30px rgba(0,0,0,.2);
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: #ccc; margin: 8px auto 0; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 8px 16px 8px; gap: 8px; }
.sheet-titles { min-width: 0; flex: 1; }
.sheet-tools { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.sheet-nav { display: flex; gap: 4px; }
.icon-btn.sm { width: 36px; height: 36px; font-size: 22px; }
.icon-btn:disabled { opacity: .3; cursor: default; }
.sheet-code { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.sheet-title { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.25; }
.sheet-title .en { display: block; font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.icon-btn { border: 0; background: var(--soft); width: 40px; height: 40px; border-radius: 50%; font-size: 22px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.sheet-body { overflow-y: auto; padding: 0 16px 16px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-img { background: #f3f3f3; border-radius: 10px; overflow: hidden; position: relative; cursor: zoom-in; }
.sheet-img img { width: 100%; height: auto; }
.sheet-img .zoom-hint { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 6px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); padding: 10px 0 4px; }
.meta b { color: var(--fg); font-weight: 600; }
.status-line { font-size: 13px; font-weight: 700; padding: 6px 0; }
.status-line.disc { color: #8a8a8a; } .status-line.new { color: var(--new); } .status-line.soldout { color: var(--warn); }
.colors-head { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 0 6px; border-bottom: 1px solid var(--line); }
.colors-head h3 { margin: 0; font-size: 15px; }
.colors-head span { font-size: 12px; color: var(--muted); }
.bulk { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bulk-all { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; min-height: 36px; cursor: pointer; }
.bulk-all input { width: 22px; height: 22px; margin: 0; }
.bulk-count { font-size: 13px; color: var(--muted); }
.bulk-in { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.bulk-in input { width: 74px; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font-size: 16px; font-weight: 700; text-align: center; -moz-appearance: textfield; }
.bulk-in input::-webkit-outer-spin-button, .bulk-in input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bulk-in .unit { font-size: 13px; color: var(--muted); }
.color-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.color-pick { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; min-height: 40px; }
.csel { width: 22px; height: 22px; margin: 0; flex: 0 0 auto; accent-color: var(--fg); }
.color-no { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--fg); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.color-row.has .color-no { background: var(--fg); color: #fff; }
.color-name { font-size: 15px; min-width: 0; }
.color-name .en { color: var(--muted); font-size: 12px; margin-left: 4px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 42px; height: 42px; border: 0; background: var(--soft); font-size: 20px; }
.stepper button:active { background: #e2e2e2; }
.stepper input { width: 56px; height: 42px; border: 0; text-align: center; font-size: 16px; font-weight: 700; outline: none; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sheet-foot { border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; background: var(--bg); }
.sheet-foot .sum { flex: 1; font-size: 14px; min-width: 0; }
.sheet-foot .sum b { font-size: 17px; }
.sheet-foot .sum small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-foot .btn { padding: 0 14px; }
.sheet-foot .btn .badge-count { background: var(--fg); }
.btn { border: 0; border-radius: 10px; padding: 0 16px; height: 44px; font-weight: 700; font-size: 15px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn.ghost { background: var(--soft); color: var(--fg); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
.nav-pn { display: flex; gap: 6px; }
@media (min-width: 720px) {
  .sheet-panel { left: 50%; right: auto; top: 50%; bottom: auto; transform: translate(-50%, -50%); width: min(880px, 94vw); max-height: 92vh; border-radius: 16px; animation: none; }
  .sheet-handle { display: none; }
  .sheet-body { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; align-items: start; }
  .sheet-img { position: sticky; top: 0; }
}

/* ---------- 확대 ---------- */
.lightbox { position: fixed; inset: 0; z-index: 60; background: #0d0d0d; touch-action: none; }
.lb-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lb-stage img { max-width: 100%; max-height: 100%; user-select: none; -webkit-user-drag: none; transform-origin: 0 0; will-change: transform; }
.lb-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 2; background: rgba(255,255,255,.15); color: #fff; }
.lb-hint { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: #bbb; font-size: 12px; z-index: 2; pointer-events: none; }

/* ---------- 발주서 ---------- */
.order-wrap { max-width: 860px; margin: 0 auto; }
.order-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 0 6px; }
.order-head h1 { margin: 0; font-size: 20px; }
.order-head .hint { font-size: 12px; color: var(--muted); flex: 1; }
.order-head .back { margin-left: auto; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 0; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form input, .form textarea { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; background: var(--bg); min-height: 44px; }
.form .full { grid-column: 1 / -1; }
.order-lines { margin-top: 8px; border-top: 2px solid var(--fg); }
.ol-prod { border-bottom: 1px solid var(--line); padding: 10px 0; display: grid; grid-template-columns: 64px 1fr; gap: 10px; }
.ol-prod img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; background: #f3f3f3; }
.ol-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ol-title b { font-size: 15px; }
.ol-title .nm { font-size: 14px; }
.ol-title .rm { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 13px; text-decoration: underline; min-height: 32px; }
.ol-colors { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.ol-color { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; font-size: 14px; }
.ol-color .color-no { width: 24px; height: 24px; font-size: 11px; }
.ol-color .stepper button { width: 36px; height: 36px; font-size: 17px; }
.ol-color .stepper input { width: 48px; height: 36px; font-size: 15px; }
.ol-sum { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0; font-size: 14px; border-bottom: 2px solid var(--fg); }
.ol-sum b { font-size: 18px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px 0; }
.actions .btn { height: 48px; }
.actions .wide { grid-column: 1 / -1; }
.order-preview { background: var(--soft); border-radius: 10px; padding: 12px; font-size: 13px; white-space: pre-wrap; word-break: break-all; line-height: 1.5; margin-top: 6px; font-family: ui-monospace, "Noto Sans KR", monospace; }
.order-empty { padding: 40px 0; text-align: center; color: var(--muted); }
.order-empty .btn { margin-top: 12px; }

/* ---------- 책자 ---------- */
.book { position: relative; margin: 0 -16px; }
@media (min-width: 960px) { .book { margin: 0 -24px; } }
.book-bar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.book-bar input[type=range] { flex: 1; min-width: 60px; }
.book-bar .pg { font-weight: 700; color: var(--fg); white-space: nowrap; min-width: 72px; text-align: center; }
.book-pages { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; height: calc(100dvh - var(--top-h) - var(--nav-h) - 44px - env(safe-area-inset-bottom)); }
.book-pages::-webkit-scrollbar { display: none; }
.page { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow-y: auto; padding: 14px 16px 24px; border-right: 1px solid var(--line); background: var(--bg); }
.page-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1.5px solid var(--fg); padding-bottom: 6px; margin-bottom: 12px; }
.page-head .cat { font-size: 14px; font-weight: 700; letter-spacing: .5px; }
.page-head .cat small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.page-head .no { font-size: 12px; color: var(--muted); }
.page-body { display: grid; gap: 16px; }
.pblock { display: grid; gap: 8px; cursor: pointer; }
.pblock .pimg { background: #f3f3f3; border-radius: 8px; overflow: hidden; position: relative; }
.pblock .pimg .pc { position: absolute; right: 8px; bottom: 8px; }
.pblock .ptxt { font-size: 13px; }
.pblock .ptxt b { font-size: 15px; display: block; }
.pblock .ptxt .en { color: var(--muted); }
.pblock .comp { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pblock .clist { font-size: 12px; color: #444; margin-top: 4px; columns: 2; column-gap: 12px; }
.pblock .clist div { break-inside: avoid; }
.pblock .in-cart { font-size: 12px; color: var(--ok); font-weight: 700; }
.toc { display: grid; gap: 6px; }
.toc a { display: flex; justify-content: space-between; padding: 10px 4px; border-bottom: 1px dotted #ccc; font-size: 15px; }
.toc a small { color: var(--muted); }
.cover { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; text-align: center; gap: 8px; }
.cover .big { font-family: "Adobe Myungjo Std M", serif; font-size: 40px; font-weight: 700; }
.cover .ver { color: var(--muted); }
@media (min-width: 720px) { .page-body { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .page-body { grid-template-columns: 1fr 1fr 1fr; } }
.book-btn { border: 1px solid var(--line); background: var(--bg); width: 36px; height: 36px; border-radius: 8px; font-size: 16px; }

/* ---------- 안내 ---------- */
.info-wrap { max-width: 720px; margin: 0 auto; padding-top: 12px; }
.info-wrap h1 { font-size: 20px; margin: 10px 0 4px; }
.info-wrap h2 { font-size: 15px; margin: 18px 0 6px; }
.info-wrap p, .info-wrap li { font-size: 14px; }
.info-box { background: var(--soft); border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.6; }
.chg { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.chg .tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; color: #fff; background: var(--new); }
.chg .tag.disc { background: #8a8a8a; }

/* ---------- 탭 · 즐겨찾기 · 상태 ---------- */
.tabs { display: flex; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tabs a { flex: 1; text-align: center; padding: 9px 4px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; min-height: 40px; }
.tabs a.active { color: var(--fg); font-weight: 700; border-bottom-color: var(--fg); }
.tabs a span { font-size: 11px; color: var(--muted); margin-left: 2px; }
.tabs a span:empty { display: none; }
.chips { padding-top: 8px; }
.tab-note { font-size: 13px; color: var(--muted); background: var(--soft); border-radius: 8px; padding: 8px 12px; margin: 8px 0 2px; }
.fav-btn { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border: 0; background: rgba(255,255,255,.88); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.fav-btn svg { fill: none; stroke: #555; stroke-width: 2; }
.fav-btn.on svg { fill: var(--new); stroke: var(--new); }
.fav-btn:active { transform: scale(.92); }
.sheet-tools .fav-btn { position: static; background: var(--soft); box-shadow: none; width: 36px; height: 36px; }
.badge.low { background: var(--warn); }
.chg .tag.low { background: var(--warn); }
.note-line { font-size: 13px; color: var(--fg); background: #fff7e0; border-radius: 8px; padding: 8px 10px; margin: 4px 0; }
.prod-note { font-size: 13px; color: var(--fg); background: var(--soft); border-left: 3px solid var(--fg); border-radius: 0 8px 8px 0; padding: 8px 10px; margin: 8px 0 4px; }
.tag-prod { font-size: 11px; font-weight: 700; color: var(--ok); background: #e9f6ec; border-radius: 5px; padding: 2px 7px; white-space: nowrap; }
.ol-sub { font-size: 12px; color: var(--muted); }
/* 코드별 합계 (단가표 코드 → 품목) */
.code-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; padding: 8px 0 4px; }
.code-sum .k { color: var(--muted); font-size: 12px; margin-right: 2px; }
.code-sum .cs { background: var(--soft); border-radius: 6px; padding: 3px 8px; white-space: nowrap; }
.code-sum .cs b { display: inline-block; min-width: 12px; }
.code-sum .cs em { font-style: normal; font-weight: 700; }
.code-sum .ct { flex-basis: 100%; font-weight: 700; padding-top: 2px; }
.code-sum .ct em { font-style: normal; font-size: 15px; }
.pdf-link { font-size: 13px; font-weight: 600; color: var(--fg); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.btn-pdf { display: inline-flex; align-items: center; flex: 0 0 auto; font-weight: 700; }
.btn-pdf .long { display: none; }
@media (min-width: 960px) { .btn-pdf .short { display: none; } .btn-pdf .long { display: inline; } }

/* ---------- 로그인 · 내정보 · 주문 이력 ---------- */
.auth-panel { padding-bottom: env(safe-area-inset-bottom); }
.auth-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px 0; }
.auth-tabs { display: flex; gap: 2px; background: var(--soft); border-radius: 10px; padding: 3px; }
.auth-tabs button { border: 0; background: transparent; padding: 8px 16px; border-radius: 8px; font-size: 14px; color: var(--muted); min-height: 38px; }
.auth-tabs button.active { background: var(--bg); color: var(--fg); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.auth-form { display: grid; gap: 10px; padding: 12px 16px 18px; overflow-y: auto; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.auth-form input { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; background: var(--bg); color: var(--fg); min-height: 44px; }
.auth-form .btn.wide { margin-top: 4px; }
.auth-hint { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.5; }
.me-wrap { max-width: 720px; margin: 0 auto; padding-top: 12px; }
.me-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 4px; margin-bottom: 14px; }
.me-card .co { font-size: 17px; font-weight: 700; }
.me-card .sub { font-size: 13px; color: var(--muted); }
.me-card .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.st-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.st-pending { background: #fff3d6; color: var(--warn); } .st-approved { background: #e9f6ec; color: var(--ok); } .st-rejected, .st-blocked { background: #eee; color: #777; }
.st-new { background: #e8f0fe; color: #1a56c4; } .st-ok { background: #e9f6ec; color: var(--ok); } .st-done { background: #eee; color: #555; } .st-cancel { background: #fdecea; color: var(--new); }
.login-wall { text-align: center; padding: 40px 16px; }
.login-wall p { color: var(--muted); }
.login-wall .btn { margin: 4px; }
.ord { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.ord summary { list-style: none; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; padding: 10px 12px; cursor: pointer; align-items: center; }
.ord summary::-webkit-details-marker { display: none; }
.ord .ord-no { font-weight: 700; }
.ord .ord-date { font-size: 12px; color: var(--muted); }
.ord .ord-sum { grid-column: 1 / -1; font-size: 13px; }
.ord-body { border-top: 1px solid var(--line); padding: 10px 12px; }
.ord-prod { padding: 6px 0; border-bottom: 1px dotted var(--line); font-size: 14px; }
.ord-prod b { margin-right: 6px; }
.ord-prod .cl { font-size: 13px; color: #444; margin-top: 2px; }
.ord-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.hist { margin-top: 18px; border-top: 2px solid var(--fg); padding-top: 6px; }
.hist > summary { list-style: none; cursor: pointer; font-size: 16px; font-weight: 700; padding: 8px 0; display: flex; align-items: baseline; gap: 8px; }
.hist > summary::-webkit-details-marker { display: none; }
.hist > summary::before { content: '▸'; font-size: 12px; color: var(--muted); }
.hist[open] > summary::before { content: '▾'; }
.hist > summary small { font-size: 12px; color: var(--muted); font-weight: 400; }
.hist-list { display: grid; gap: 8px; }
.hist-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; }
.hist-main b { font-size: 14px; }
.hist-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.hist-prods { margin-top: 8px; display: grid; gap: 6px; }
.hist-prod { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; font-size: 14px; }
.hist-prod .thumb { display: block; width: 64px; height: 48px; border-radius: 6px; overflow: hidden; background: #f3f3f3; }
.hist-prod .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hist-prod b { margin-right: 6px; }
.hist-prod .cl { font-size: 13px; color: #444; margin-top: 2px; }
.hist-prod .cl b { margin-right: 0; }
.hist-prod .cl small { color: var(--muted); margin-left: 2px; }
.hist-prod .tag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-right: 6px; color: #fff; background: #8a8a8a; }
.hist-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hist-actions .rm { margin-left: auto; border: 0; background: transparent; color: var(--muted); text-decoration: underline; font-size: 13px; min-height: 32px; }
.hist-foot { display: flex; align-items: center; gap: 10px; padding: 10px 0 4px; flex-wrap: wrap; }
.hist-foot .rm { margin-left: auto; border: 0; background: transparent; color: var(--muted); text-decoration: underline; font-size: 13px; }
@media (min-width: 720px) { .hist-row { grid-template-columns: 1fr auto; align-items: center; } }
.confirm-box { border: 2px solid var(--fg); border-radius: 12px; padding: 16px; margin: 12px 0; }
.confirm-box h2 { margin: 0 0 6px; font-size: 18px; }
.confirm-box .no { font-size: 22px; font-weight: 700; letter-spacing: .02em; }
.orderer { background: var(--soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.orderer .btn { flex: 0 0 auto; }

/* ---------- 발주서 인쇄 ---------- */
#print-area { display: none; }
@media print {
  @page { size: A4; margin: 0; }   /* 여백은 .pr-page 표의 머리/꼬리(매 페이지 반복)와 본문 칸 패딩으로 잡는다 → 인쇄창 여백 설정과 무관 */
  html, body { margin: 0 !important; padding: 0 !important; background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; font-size: 12px; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pr-page { width: 100%; border-collapse: collapse; }
  .pr-page > thead > tr > td.pr-gap, .pr-page > tfoot > tr > td.pr-gap { height: 14mm; padding: 0; border: 0; }
  .pr-page > tbody > tr > td.pr-body { padding: 0 12mm; border: 0; vertical-align: top; }
  .pr-lines thead { display: table-header-group; }   /* 표 머리는 매 페이지 반복 */
  .pr-lines td.pimg { width: 52px; padding: 3px; } .pr-lines td.pimg img { width: 46px; height: 34px; object-fit: cover; display: block; }
  .pr-check { display: inline-block; width: 13px; height: 13px; border: 1px solid #000; vertical-align: middle; }
  .pr-sheet + .pr-sheet { break-before: page; page-break-before: always; }   /* 피킹리스트: 주문마다 새 장 */
  .pr-lines tfoot { display: table-row-group; }      /* 합계는 맨 끝에 한 번만 */
  .pr-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 10px; }
  .pr-title { font-size: 24px; font-weight: 700; }
  .pr-sub { font-size: 12px; color: #444; }
  .pr-meta { text-align: right; font-size: 12px; line-height: 1.6; }
  .pr-buyer { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
  .pr-buyer th { text-align: left; background: #f0f0f0; padding: 6px 8px; width: 12%; font-weight: 600; border: 1px solid #ccc; }
  .pr-buyer td { padding: 6px 8px; border: 1px solid #ccc; width: 21%; }
  .pr-lines { width: 100%; border-collapse: collapse; }
  .pr-lines th { background: #f0f0f0; border: 1px solid #bbb; padding: 6px 8px; text-align: left; font-weight: 600; }
  .pr-lines td { border: 1px solid #ccc; padding: 5px 8px; }
  .pr-lines .num { text-align: right; font-variant-numeric: tabular-nums; }
  .pr-lines tfoot td { font-weight: 700; background: #fafafa; border-top: 2px solid #000; }
  .pr-lines tr { break-inside: avoid; }
  .pr-codes { width: auto; min-width: 55%; margin-top: 10px; break-inside: avoid; }
  .pr-note { margin-top: 10px; padding: 8px 10px; border: 1px solid #bbb; border-radius: 4px; }
  .pr-memo { margin-top: 10px; }
  .pr-sign { display: flex; justify-content: space-between; margin-top: 36px; font-size: 13px; }
}

/* ---------- 주문 확정 전 확인 창 ---------- */
.confirm-panel { max-height: 92dvh; }
.cf-title { margin: 0; font-size: 18px; }
.cf-body { overflow-y: auto; padding: 4px 16px 10px; font-size: 14px; }
.cf-lead { margin: 4px 0 10px; font-size: 14px; line-height: 1.5; }
.cf-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 3px; font-size: 13px; margin-bottom: 10px; }
.cf-card .k, .cf-memo .k { display: inline-block; min-width: 46px; color: var(--muted); font-size: 12px; }
.cf-list { border-top: 2px solid var(--fg); }
.cf-prod { padding: 8px 0; border-bottom: 1px solid var(--line); }
.cf-prod-h { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.cf-prod-h .nm { flex: 1; min-width: 0; }
.cf-prod-h .sub { font-weight: 700; white-space: nowrap; }
.cf-prod .cl { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 13px; color: #444; }
.cf-prod .cl b { color: var(--fg); }
.cf-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 10px 0 4px; font-size: 14px; }
.cf-total b { font-size: 20px; margin-left: auto; }
.cf-total small { width: 100%; color: var(--muted); font-size: 12px; }
.cf-memo { padding: 6px 0; font-size: 13px; }
.cf-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.cf-foot { display: flex; gap: 8px; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.cf-foot .btn { flex: 1; }
.cf-foot .btn:not(.ghost) { flex: 1.4; }
@media (min-width: 960px) { .confirm-panel { width: min(600px, 94vw); } }

/* ---------- 주문 진행 단계 ---------- */
.ord-steps { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 2px 0 8px; font-size: 12px; }
.ord-steps .step { padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.ord-steps .step.done { background: #e9f6ec; color: var(--ok); }
.ord-steps .step.cur { background: var(--fg); color: #fff; font-weight: 700; }
.ord-steps .step.cancel { background: #fdecea; color: var(--new); font-weight: 700; }
.ord-steps .step.picked { background: #fff3d6; color: #7a4b00; }
.ord-steps .arrow { color: #bbb; }
.note-line .link, .linkbtn { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.profile-form { padding: 6px 0 0; }
.profile-form .row { display: flex; gap: 8px; }

/* ---------- 개인정보 안내 (가입신청) ---------- */
.consent { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12px; color: #333; line-height: 1.5; background: var(--soft); }
.consent > b { font-size: 13px; }
.consent ul { margin: 6px 0; padding-left: 16px; }
.consent li b { margin-right: 4px; }
.consent p { margin: 4px 0 8px; color: var(--muted); }
.consent a { text-decoration: underline; }
.auth-form .consent-check { display: flex; flex-direction: row; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--fg); font-weight: 700; }
.auth-form .consent-check input { width: 20px; height: 20px; margin: 1px 0 0; min-height: 0; flex: 0 0 auto; }
.cat-card a.link { text-decoration: underline; color: var(--muted); }
.me-card .btn.withdraw { color: var(--muted); }

/* ---------- 토스트 ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 70; max-width: 90vw; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
