* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Malgun Gothic", sans-serif; font-size: 16px;
       color: #1d232a; background: #f3f4f5; }
a { color: #0b5a7a; }

.top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 16px;
       background: #0f7f78; color: #fff; }
.top .brand { color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; }
.top .who { font-size: 14px; color: #c9d6df; }

main { padding: 16px; max-width: 640px; }
h1 { font-size: 20px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }

.card { background: #fff; border: 1px solid #d9dde1; border-radius: 6px; padding: 16px; margin-bottom: 16px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 14px; color: #4a5560; margin-bottom: 4px; }
input, select { width: 100%; max-width: 100%; min-width: 0; min-height: 46px; padding: 8px 10px; font: inherit; border: 1px solid #aab3bb;
                border-radius: 4px; background: #fff; }
input:focus, select:focus { outline: 2px solid #0b5a7a; outline-offset: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 46px; }
.check input { width: 22px; min-height: 22px; flex: 0 0 22px; }

button, .big { font: inherit; border-radius: 4px; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
.primary { width: 100%; min-height: 50px; border: 0; background: #0f7f78; color: #fff; font-weight: 600; }
.big { display: block; width: 100%; min-height: 54px; padding: 14px 16px; text-align: left; text-decoration: none;
       color: #1d232a; background: #fff; border: 1px solid #c4cbd1; font-size: 17px; }
.big.quiet { background: transparent; color: #4a5560; }
.small { min-height: 40px; padding: 6px 10px; border: 1px solid #aab3bb; background: #fff; }
.stack > * { margin-bottom: 10px; }

.msg { margin: 8px 0 0; font-size: 15px; }
.msg:empty { display: none; }
.msg.bad { color: #b42318; }
.msg.ok { color: #0b6e4f; }
.hint { color: #5d6873; font-size: 14px; }

.rows { list-style: none; margin: 0 0 16px; padding: 0; }
.rows li { background: #fff; border: 1px solid #d9dde1; border-radius: 6px; padding: 12px; margin-bottom: 8px; }
.rows .name { display: block; font-weight: 600; margin-bottom: 8px; overflow-wrap: anywhere; }
.rows .name small { font-weight: 400; color: #5d6873; }
.rows .stopped { color: #b42318; font-style: normal; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions select { width: auto; min-height: 40px; flex: 1 1 110px; }

.searchbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.searchbar input { flex: 1 1 100%; }
.searchbar select { flex: 1 1 140px; width: auto; min-width: 0; max-width: 100%; }
.rows li.link { padding: 0; }
.rows li.link a { display: block; padding: 12px; color: inherit; text-decoration: none; min-height: 54px; }
.rows li.link .name { margin-bottom: 2px; }
.rows small { display: block; color: #5d6873; overflow-wrap: anywhere; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.counts { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.counts b { font-size: 18px; }
details.issue { border-top: 1px solid #e3e6e9; padding: 8px 0; }
details.issue summary { cursor: pointer; min-height: 32px; }
details.issue.bad summary { color: #b42318; font-weight: 600; }
.lines { font-size: 14px; color: #4a5560; overflow-wrap: anywhere; margin: 6px 0 0; }
input[type=file] { padding: 10px; }
.field.check { display: flex; }

/* 단가 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 14px; font-weight: 600; }
.badge.ok { background: #e3f4ec; color: #0b6e4f; }
.badge.discount { background: #e5eff7; color: #0b5a7a; }
.badge.approval { background: #fdf0d5; color: #8a5a00; }
.badge.blocked { background: #fde4e1; color: #b42318; }
.result { border-left: 4px solid #aab3bb; background: #fff; padding: 10px 14px; margin-bottom: 16px; }
.result.ok { border-color: #0b6e4f; }
.result.discount { border-color: #0b5a7a; }
.result.approval { border-color: #c98a00; }
.result.blocked { border-color: #b42318; }
.result ul { margin: 6px 0; padding-left: 20px; }
.gprices { display: flex; gap: 6px; margin-top: 6px; }
.gp { flex: 1 1 0; min-width: 0; font-weight: 600; font-size: 15px; }
.gp small { display: block; font-weight: 400; }
.hist { list-style: none; padding: 0; margin: 0; }
.hist li { padding: 6px 0; border-top: 1px solid #eef0f2; overflow-wrap: anywhere; }
.hist li:first-child { border-top: 0; }
.hist li.old { color: #7a848d; }
.picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.tablewrap { overflow-x: auto; margin-bottom: 14px; }
table.grid { border-collapse: collapse; width: 100%; table-layout: fixed; }
table.grid th:first-child { width: 22%; white-space: normal; }
table.grid th, table.grid td { border: 1px solid #e3e6e9; padding: 4px; vertical-align: top; font-size: 14px; }
table.grid th { background: #f6f7f8; text-align: left; white-space: nowrap; }
table.grid td label { display: block; }
table.grid td input { min-height: 36px; padding: 4px 6px; }

/* 주문 */
.big.main { background: #0f7f78; color: #fff; border-color: #0f7f78; font-weight: 700; }
.big.attention { border-color: #c98a00; background: #fdf6e3; font-weight: 600; }
.badge.muted { background: #eceff1; color: #5d6873; }
.picks.col { flex-direction: column; }
.pick { display: block; width: 100%; text-align: left; min-height: 48px; padding: 8px 12px; background: #fff;
        border: 1px solid #c4cbd1; border-radius: 4px; font: inherit; }
.pick small { color: #5d6873; }
.chosen { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.chosen small { color: #5d6873; flex: 1 1 100%; }
.lines .line { border-top: 1px solid #e3e6e9; padding: 12px 0; }
.lines .line:first-child { border-top: 0; }
.lhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.lhead b { overflow-wrap: anywhere; }
.line > small { display: block; color: #5d6873; }
.lrow { display: flex; gap: 10px; align-items: flex-end; margin-top: 8px; }
.qtybox { display: flex; flex: 0 0 auto; }
.qtybox .qty { width: 64px; text-align: center; border-radius: 0; }
.step { width: 46px; min-height: 46px; font-size: 22px; border: 1px solid #aab3bb; background: #f6f7f8; }
.step:first-child { border-radius: 4px 0 0 4px; }
.step:last-child { border-radius: 0 4px 4px 0; }
.pricebox { flex: 1 1 auto; min-width: 0; }
.pricebox small, .srcbox small { display: block; color: #5d6873; }
.auto { display: block; color: #5d6873; margin-top: 4px; }
.lcheck { margin-top: 4px; }
.lcheck small { color: #4a5560; }
.reason { margin-top: 6px; }
.srcbox { display: block; margin-top: 6px; }
.srcbox select { min-height: 40px; }
.savebar { position: sticky; bottom: 0; background: #fff; border: 1px solid #c4cbd1; border-radius: 6px;
           padding: 12px; margin: 16px 0; box-shadow: 0 -2px 8px rgba(0,0,0,.06); }
.savebar > div { margin-bottom: 8px; overflow-wrap: anywhere; }
.problems { margin: 0 0 8px; padding-left: 18px; color: #b42318; font-size: 14px; }
.problems:empty { display: none; }
dl.info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0 0 16px; }
dl.info dt { color: #5d6873; }
dl.info dd { margin: 0; overflow-wrap: anywhere; }
.rows.plain li { padding: 10px 0; border: 0; border-top: 1px solid #eef0f2; border-radius: 0; margin: 0; }
.rows.plain li:first-child { border-top: 0; }
.costline { color: #8a5a00 !important; }

/* 장부 */
.period { display: flex; gap: 8px; }
.period .field { flex: 1 1 0; min-width: 0; }
.balance { font-size: 18px; }
.balance b { font-size: 22px; }
.rows li.muted { color: #6b757e; background: #f7f8f9; }
.amt { white-space: nowrap; }

/* 원문 · 상차/하차 확인 */
textarea { width: 100%; max-width: 100%; min-width: 0; padding: 8px 10px; font: inherit; border: 1px solid #aab3bb;
           border-radius: 4px; background: #fff; resize: vertical; }
textarea:focus { outline: 2px solid #0b5a7a; outline-offset: 0; }
.src { background: #fffbea; border: 1px solid #e6d38a; border-radius: 4px; padding: 8px 10px; margin: 8px 0; }
.src small { color: #6b5a12; }
.src pre { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; font: inherit; }
.tline { border: 1px solid #d9dde1; border-radius: 6px; padding: 12px; margin: 10px 0; background: #fff; }
.tline.ok { border-color: #0b6e4f; background: #eef8f3; }
.tline.bad { border-color: #b42318; background: #fdf0ef; }
.tname { font-size: 18px; font-weight: 600; margin: 0 0 4px; word-break: break-word; }
.tqty { font-size: 20px; font-weight: 700; margin: 0 0 8px; }
.okmark { color: #0b6e4f; }
b.diff { color: #b42318; font-size: 1.1em; text-decoration: underline; }
.cands { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.cand { width: 100%; min-height: 50px; text-align: left; padding: 8px 12px; background: #fff; border: 2px solid #aab3bb; font-size: 16px; }
.cand.on { border-color: #0b5a7a; background: #e6f1f6; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.thumbs img { width: 88px; height: 88px; object-fit: cover; border-radius: 4px; border: 1px solid #d9dde1; }

/* 주문방 */
.chatlist { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.bubble { background: #fff; border: 1px solid #d9dde1; border-radius: 8px; padding: 8px 10px; max-width: 92%; }
.bubble.mine { align-self: flex-end; background: #eef5f9; }
.bubble.open { border-color: #c98a00; border-width: 2px; }
.bubble.muted { opacity: .6; }
.bubble pre { margin: 4px 0; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 16px; }
.bubble small { color: #5d6873; }
.bubble .flag { color: #b42318; }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.olink { font-size: 14px; padding: 4px 8px; border-radius: 12px; border: 1px solid #aab3bb; text-decoration: none; color: #1d232a; }
.olink.ok { border-color: #0b6e4f; color: #0b6e4f; }
.olink.warn { border-color: #b42318; color: #b42318; }
.olink.muted { opacity: .6; text-decoration: line-through; }
.chatform { display: flex; flex-direction: column; gap: 8px; }

.small.primary { width: auto; background: #0f7f78; color: #fff; border-color: #0f7f78; }

/* 틀: 큰 화면은 왼쪽 메뉴, 폰은 메뉴 버튼 */
.ico { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.8;
       stroke-linecap: round; stroke-linejoin: round; }
.shell { min-height: 100vh; }
.page { min-width: 0; }
.side { position: fixed; top: 0; bottom: 0; left: 0; width: 248px; background: #0b4f4b; color: #e3f3f1; overflow-y: auto;
        padding: 14px 10px 20px; z-index: 30; transform: translateX(-100%); transition: transform .2s; display: flex; flex-direction: column; }
body.menu-open .side { transform: none; }
.scrim { display: none; }
body.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
.side-brand { color: #fff; font-weight: 800; font-size: 22px; text-decoration: none; padding: 6px 10px 12px; }
.side-group { margin: 14px 10px 4px; font-size: 12px; color: #9fd3cd; letter-spacing: .04em; }
.side-link { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 8px 10px; border-radius: 8px;
             color: #e3f3f1; text-decoration: none; font-size: 15px; }
.side-link span:not(.nbadge) { flex: 1 1 auto; }
.side-link:hover { background: rgba(255,255,255,.08); }
.side-link.on { background: #e3f3f1; color: #0b4f4b; font-weight: 700; }
.side-foot { margin-top: auto; padding: 16px 10px 0; color: #9fd3cd; }
.side-foot .big.quiet { color: #e3f3f1; border-color: rgba(255,255,255,.3); min-height: 42px; padding: 8px 12px; margin-top: 6px; }
.nbadge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
          border-radius: 11px; background: #d9480f; color: #fff; font-size: 13px; font-weight: 700; font-style: normal; }
.nbadge.lg { min-width: 28px; height: 28px; border-radius: 14px; font-size: 15px; }
.menu-btn { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.15); color: #fff; border: 0;
            min-height: 38px; padding: 4px 12px; font-weight: 600; }
@media (min-width: 900px) {
  .side { transform: none; }
  .page { margin-left: 248px; }
  .menu-btn, .scrim { display: none !important; }
  .shell .top .brand { display: none; }
  main { padding: 24px 32px; max-width: 760px; }
  main.wide { max-width: 1180px; }
}

/* 처음 화면 카드판 */
.dash { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .dash { grid-template-columns: 1fr 1fr; } }
.dcard { margin: 0; border-radius: 12px; padding: 18px 20px; }
.dhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.dhead h2 { margin: 0; }
.okpill { font-size: 13px; font-weight: 700; color: #0b6e4f; background: #e3f4ec; border-radius: 12px; padding: 3px 10px; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { border-top: 1px solid #eef0f2; }
.todo li:first-child { border-top: 0; }
.todo a { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 50px; padding: 6px 2px;
          color: inherit; text-decoration: none; font-size: 16px; }
.todo li.hot a { font-weight: 700; }
.todo li.calm a { color: #7a848d; }
.todo .zero { color: #9aa3ab; font-weight: 400; min-width: 22px; text-align: center; }
.tripl { list-style: none; margin: 0; padding: 0; }
.tripl li { border-top: 1px solid #eef0f2; }
.tripl li:first-child { border-top: 0; }
.tripl a { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 2px 10px; align-items: center;
           min-height: 54px; padding: 8px 2px; color: inherit; text-decoration: none; }
.tripl b { font-size: 17px; }
.tripl small { grid-column: 1; color: #5d6873; }
.tripl .spill { grid-column: 2; grid-row: 1 / 3; }
.spill { font-size: 13px; font-weight: 700; border-radius: 12px; padding: 4px 10px; white-space: nowrap; }
.spill.wait { background: #fdf0d5; color: #8a5a00; }
.spill.go { background: #e0f2f1; color: #0b4f4b; }
.spill.done { background: #eceff1; color: #5d6873; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qbtn { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 10px 14px; border: 1px solid #c4cbd1; border-radius: 10px;
        background: #fff; color: #1d232a; text-decoration: none; font-weight: 600; }
.qbtn.main { background: #0f7f78; border-color: #0f7f78; color: #fff; }
.money { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; align-items: baseline; }
.money dt { color: #5d6873; }
.money dd { margin: 0; text-align: right; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.money a { color: inherit; text-decoration: none; }

/* 주문방 글 → 출하지시서 초안 */
.draftcard { border: 2px solid #c98a00; background: #fffbf0; }
.pend { border-top: 1px solid #ecd9a6; padding: 10px 0; }
.pend.on { background: #e6f1f6; }
.pend p { margin: 0 0 6px; overflow-wrap: anywhere; }
.bubble { cursor: default; }
