:root {
  --bg: #f7f3f0; --card: #ffffff; --ink: #2b2522; --sub: #7a6e68; --line: #e8dfda;
  --brand: #2b2522; --blush: #e6d3c8; --accent: #b4766a;
  --ok: #2f7d55; --warn: #b7791f; --bad: #c0392b; --info: #2c6aa0;
  --r: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; font-size: 15px; }
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
a { color: var(--info); }
button, input, select, textarea { font: inherit; color: inherit; }

header.top { position: sticky; top: 0; z-index: 10; background: var(--brand); color: #fff; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; display: flex; align-items: center; gap: 10px; }
header.top h1 { font-size: 17px; margin: 0; flex: 1; letter-spacing: -0.3px; }
header.top .back { background: none; border: 0; color: #fff; font-size: 22px; padding: 0 6px 0 0; cursor: pointer; }
header.top .act { background: var(--blush); color: var(--brand); border: 0; border-radius: 999px; padding: 7px 14px; font-weight: 700; cursor: pointer; }

main { max-width: 960px; margin: 0 auto; padding: 14px 16px 24px; }

nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom); }
nav.tabs a { flex: 1; text-align: center; padding: 9px 0 8px; color: var(--sub); text-decoration: none; font-size: 11.5px; font-weight: 600; }
nav.tabs a .ic { display: block; font-size: 19px; line-height: 1.2; }
nav.tabs a.on { color: var(--ink); }
nav.tabs a.on .ic { transform: scale(1.08); }

@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 92px; }
  nav.tabs { top: 0; bottom: 0; right: auto; width: 92px; flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding-top: 70px; }
  nav.tabs a { flex: none; padding: 14px 0; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; font-size: 14px; color: var(--sub); font-weight: 700; }
.grid { display: grid; gap: 10px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 700px) { .g4m { grid-template-columns: repeat(4, 1fr); } }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; cursor: pointer; }
.stat .n { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.stat .l { color: var(--sub); font-size: 12.5px; margin-top: 2px; }
.big { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.muted { color: var(--sub); font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.sp { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.right { text-align: right; }

.list .item { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 8px; color: inherit; text-decoration: none; }
.list .item .t { font-weight: 700; }
.list .item .s { color: var(--sub); font-size: 13px; margin-top: 3px; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #eee; white-space: nowrap; }
.b-입금대기 { background: #fff3dc; color: #8a5a00; }
.b-입금완료 { background: #e3effa; color: #1d5a8f; }
.b-포장중 { background: #efe7ff; color: #5b3aa6; }
.b-출고 { background: #e2f4ea; color: #1f6b44; }
.b-배송완료 { background: #ececec; color: #555; }
.b-취소 { background: #fde8e6; color: #a5281b; }
.b-반품 { background: #fde8e6; color: #a5281b; }
.g-단골 { background: #f3e6df; color: #8a4f3f; }
.g-파트너 { background: #2b2522; color: #e6d3c8; }
.g-유통 { background: #b4766a; color: #fff; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

label.f { display: block; margin-bottom: 10px; }
label.f > span { display: block; font-size: 12.5px; color: var(--sub); font-weight: 600; margin-bottom: 4px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; background: #fff; font-size: 16px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blush); border-color: var(--accent); }
input[type=checkbox] { width: auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 14px; font-weight: 700; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn.pri { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.acc { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.full { width: 100%; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.t th { color: var(--sub); font-size: 12px; font-weight: 700; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
.sum div { display: flex; justify-content: space-between; padding: 4px 0; }
.sum .tot { font-size: 18px; font-weight: 800; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }

.steps { display: flex; gap: 4px; margin: 6px 0 4px; }
.steps div { flex: 1; text-align: center; font-size: 11px; color: var(--sub); }
.steps div::before { content: ''; display: block; height: 5px; border-radius: 3px; background: var(--line); margin-bottom: 5px; }
.steps div.on { color: var(--ink); font-weight: 700; }
.steps div.on::before { background: var(--accent); }

.copybox { white-space: pre-wrap; background: #faf7f5; border: 1px dashed var(--line); border-radius: 10px; padding: 10px; font-size: 14px; }
.warn { color: var(--warn); }
.err { color: var(--bad); }
.empty { text-align: center; color: var(--sub); padding: 30px 0; }

.fab { position: fixed; right: 18px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 15; width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 30px; border: 0; box-shadow: 0 6px 18px rgba(0,0,0,.18); cursor: pointer; }
@media (min-width: 900px) { .fab { bottom: 24px; } }

#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; margin-bottom: -72px; }
.login .box { width: 100%; max-width: 340px; text-align: center; }
.login .logo { font-family: Georgia, serif; font-size: 28px; letter-spacing: 3px; font-weight: 700; }
.login .sub { color: var(--sub); margin: 6px 0 24px; font-size: 13px; }

.stockgrid { overflow-x: auto; }
.stockgrid th { white-space: nowrap; }
.stockgrid table td.q { text-align: center; font-weight: 700; cursor: pointer; min-width: 52px; }
.stockgrid td.low { color: var(--bad); background: #fdf1ef; }
.stockgrid td.zero { color: #bbb; }
.itemline { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.itemline:last-child { border-bottom: 0; }
.qty { display: flex; align-items: center; gap: 4px; }
.qty button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 18px; cursor: pointer; }
.qty b { min-width: 24px; text-align: center; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: #fff; padding: 9px 4px; font-weight: 600; cursor: pointer; font-size: 14px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: #fff; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

/* 자료 탭 */
details.info { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; overflow: hidden; }
details.info summary { cursor: pointer; padding: 14px; font-weight: 800; font-size: 15px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.info summary::-webkit-details-marker { display: none; }
details.info summary::after { content: '＋'; color: var(--sub); font-weight: 400; }
details.info[open] summary::after { content: '－'; }
details.info[open] summary { border-bottom: 1px solid var(--line); background: #fbf8f6; }
details.info .ib { padding: 12px 14px 14px; line-height: 1.6; }
details.info .ib ul { margin: 6px 0 10px; padding-left: 18px; }
details.info .ib li { margin: 3px 0; }
details.info .ib h4 { margin: 14px 0 6px; font-size: 14px; }
details.info .ib h4:first-child { margin-top: 0; }
details.info .tw { overflow-x: auto; margin: 6px 0 10px; }
details.info table.t { font-size: 13px; min-width: 100%; }
details.info table.t th, details.info table.t td { white-space: nowrap; }
ol.howto { padding-left: 20px; margin: 4px 0 10px; line-height: 1.7; font-size: 14.5px; }
ol.howto code, .card code { background: #f3ece8; padding: 1px 6px; border-radius: 5px; font-size: 13px; }

/* 들어오는 물건 지도 */
.inlink { display: flex; align-items: center; gap: 12px; background: var(--ink); color: #fff; border-radius: var(--r); padding: 13px 16px; margin-bottom: 12px; text-decoration: none; }
.inlink > span:first-child { font-size: 22px; color: var(--blush); }
.inlink > div { flex: 1; } .inlink .muted { color: #cbbdb5; font-size: 12.5px; } .inlink > span:last-child { font-size: 22px; color: var(--blush); }
.mapbox { border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: #e9e1dc; min-height: 200px; }
.map-load { padding: 80px 0; text-align: center; color: var(--sub); font-size: 13px; }
.imap { display: block; width: 100%; height: auto; }
.imap .sea { fill: #e4ebee; }
.imap .ld { fill: #f7f4f2; stroke: #d9d2cd; stroke-width: .5; }
.imap .cn { fill: #f3eeea; stroke: #d6ccc5; stroke-width: .6; }
.imap .kr { fill: #e6d3c8; stroke: #b4766a; stroke-width: 1; }
.imap .route { fill: none; stroke: #b4766a; stroke-opacity: .45; stroke-width: 1.6; stroke-dasharray: 4 5; animation: march 1.4s linear infinite; }
.imap .route.r1 { stroke-width: 2; }
@keyframes march { to { stroke-dashoffset: -18; } }
.imap .trail { fill: none; stroke: #b4766a; stroke-width: 3; stroke-linecap: round; }
.imap .pl circle { fill: #fff; stroke: #2b2522; stroke-width: 2; }
.imap .pl text { font-size: 11.5px; fill: #2b2522; paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 3px; }
.imap .pl .pn { font-weight: 800; } .imap .pl .ps { font-size: 10px; fill: #7a6e68; }
.imap .pulse { fill: #b4766a; transform-box: fill-box; transform-origin: center; animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(3.2); } }
.imap .plane { fill: #2b2522; stroke: #fff; stroke-width: 1.2; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.imap .truck rect { fill: #2b2522; stroke: #fff; stroke-width: 1.2; } .imap .truck circle { fill: #2b2522; stroke: #fff; stroke-width: 1; }
.imap .veh.air .truck, .imap .veh.ground .plane { display: none; }
.icard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 14px; margin-top: 10px; }
.icard.on { border-color: var(--accent); box-shadow: 0 0 0 2px #f0e0d9; }
.icard .t { font-weight: 800; color: inherit; text-decoration: none; font-size: 15.5px; }
.isteps { display: flex; gap: 3px; margin-top: 10px; }
.isteps div { flex: 1; text-align: center; font-size: 11px; color: #b0a6a0; font-weight: 600; }
.isteps i { display: block; height: 5px; border-radius: 3px; background: var(--line); margin-bottom: 4px; }
.isteps .done { color: var(--ink); } .isteps .done i { background: var(--accent); }
.isteps .now { color: var(--accent); } .isteps .now i { background: linear-gradient(90deg, var(--accent) 50%, var(--line) 50%); }

/* 자료: 글씨 적게 */
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--sub); margin-bottom: 10px; align-items: center; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.dot.ok { background: var(--ok); } .dot.wait { background: #e0a526; } .dot.est { background: #b9b0ab; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(6, 1fr); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 10px; text-align: center; }
.tile .tb { font-size: 19px; font-weight: 800; letter-spacing: -0.5px; }
.tile .ts { font-size: 12px; color: var(--sub); margin-top: 3px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; font-size: 15px; }
.kv .k { color: var(--sub); font-size: 13.5px; white-space: nowrap; padding-top: 1px; }
.kv .v { font-weight: 600; }
.cap { font-size: 12px; color: var(--sub); margin: 8px 0 4px; }
table.t.mini { font-size: 15px; }
table.t.mini td:first-child, table.t.mini th:first-child { color: var(--sub); font-weight: 600; }
details.info .ib ul.chk { list-style: none; padding: 0; margin: 0; }
details.info .ib ul.chk li { padding: 8px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
details.info .ib ul.chk li:last-child { border-bottom: 0; }
details.info .ib ul.chk li::before { content: '○ '; color: var(--accent); }

/* 돈 */
.money3 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.money3 .m { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.money3 .m.wide { grid-column: 1 / -1; background: var(--ink); color: #fff; border-color: var(--ink); }
.money3 .m .l { font-size: 13px; color: var(--sub); font-weight: 600; }
.money3 .m.wide .l { color: var(--blush); }
.money3 .m .n { font-size: 24px; font-weight: 800; letter-spacing: -0.6px; margin-top: 4px; }
.money3 .m.wide .n { font-size: 30px; }
.in { color: var(--ok); } .out { color: var(--bad); }
.bars .b { margin: 10px 0; }
.bars .b .row { font-size: 14px; }
.bars .track { height: 8px; background: #f0e9e5; border-radius: 4px; margin-top: 5px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--accent); border-radius: 4px; }
.mrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 11px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.mrow:last-child { border-bottom: 0; }
.mrow .a { font-weight: 800; text-align: right; }
.mrow .d { font-size: 12.5px; color: var(--sub); }
.catpick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.more a.item { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 16px; }
.more a.item .ic { font-size: 20px; width: 26px; text-align: center; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; vertical-align: 1px; }
.tag.ok { background: #e2f4ea; color: #1f6b44; }
.tag.wait { background: #fff3dc; color: #8a5a00; }
.tag.est { background: #ececec; color: #666; }
@media (max-width: 420px) { nav.tabs a { font-size: 10.5px; } }

/* 색상 견본 */
.cgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 700px) { .cgrid { grid-template-columns: repeat(6, 1fr); } }
.ctile { background: #fbf8f6; border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font-size: 13px; }
.ctile .muted { font-size: 11.5px; }
.cphoto { display: inline-block; width: 22px; height: 22px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 4px; border: 1px solid rgba(0,0,0,.15); }
.cphoto.big { width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; margin: 0; }
.cphoto.none { position: relative; }
.cphoto.none { background: repeating-linear-gradient(45deg, #eee 0 6px, #f8f8f8 6px 12px); }
.cpick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
@media (min-width: 700px) { .cpick { grid-template-columns: repeat(8, 1fr); } }
.cpick button { border: 2px solid transparent; background: #fbf8f6; border-radius: 10px; padding: 4px; cursor: pointer; font-size: 11.5px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.cpick button.on { border-color: var(--accent); background: #fff; }
.cpick .cphoto.big { aspect-ratio: 2 / 1; border-radius: 6px; }
.fdet { margin-top: 10px; }
.fdet summary { cursor: pointer; font-size: 13px; color: var(--sub); font-weight: 700; padding: 6px 0; }
.fboard h4 { margin: 8px 0; font-size: 14px; }
.fgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.fgrid div { text-align: center; font-size: 12px; font-weight: 700; }
.fgrid img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; border-radius: 6px; display: block; margin-bottom: 2px; }
.cphoto.big.none::after { content: '견본 없음'; color: #999 !important; position: absolute; inset: auto 0 6px; text-align: center; color: rgba(255,255,255,.75); font-size: 11px; }
.stockgrid th.ch { white-space: nowrap; }
.cbig { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.cbig img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px; background: #f3efec; }
.cnone { height: 180px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.8); font-weight: 700; }
