/* 모음상회 주문 관리: 매장 PC와 직원 휴대폰에서 쓰는 업무용 화면. 스타일 기준은 Notion 스타일 DESIGN.md. */
:root {
  --bg: #ffffff; --soft: #f6f5f4; --ink: #1b1a18; --ink2: #31302e; --muted: #615d59; --faint: #a39e98;
  --line: #e6e6e6; --primary: #0075de; --primary-press: #005bab; --on-primary: #ffffff;
  --good: #1a8a35; --good-bg: #e7f6ea; --warn: #b45f06; --warn-bg: #fff2e0; --bad: #c4311f; --bad-bg: #fdebe8; --info-bg: #e8f1fc;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--soft); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; word-break: keep-all; overflow-wrap: break-word; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 16px; } .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }

/* 로그인 */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; display: grid; gap: 16px; }
.login-card .brand { font-size: 22px; font-weight: 700; }

/* 레이아웃 */
.shell { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; }
.side { background: var(--bg); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { font-weight: 700; font-size: 17px; padding: 4px 10px 12px; }
.side .mart { font-size: 13px; color: var(--muted); padding: 0 10px 12px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--ink2); text-decoration: none; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: var(--soft); }
.nav-item[aria-current="page"] { background: var(--info-bg); color: var(--primary-press); font-weight: 600; }
.nav-item .badge { margin-left: auto; }
.side .spacer { flex: 1; }
.side-user { border-top: 1px solid var(--line); padding: 12px 10px 4px; display: grid; gap: 6px; font-size: 13px; }
.main { padding: 24px 28px 64px; min-width: 0; max-width: 1100px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.mobile-top, .bottom-nav { display: none; }

/* 카드·타일 */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card > h2 { margin-bottom: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-align: left; cursor: default; display: block; width: 100%; }
button.tile { cursor: pointer; } button.tile:hover { background: var(--soft); }
.tile .n { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; display: block; line-height: 1.1; }
.tile .l { color: var(--muted); font-size: 13px; }
.tile.warn .n { color: var(--warn); } .tile.bad .n { color: var(--bad); } .tile.good .n { color: var(--good); }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-weight: 500; min-height: 40px; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-press); }
.btn.danger { color: var(--bad); border-color: #f0c9c3; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; }
a.btn { text-decoration: none; color: inherit; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.big { min-height: 48px; font-size: 16px; padding: 12px 22px; }

/* 입력 */
.field { display: grid; gap: 4px; min-width: 0; }
.field > label { font-size: 13px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfcbc6; border-radius: 8px; background: var(--bg); min-height: 40px; min-width: 0;
}
textarea { min-height: 120px; resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.code-input { font-size: 32px; letter-spacing: .25em; text-align: center; max-width: 230px; min-height: 60px; font-weight: 700; }

/* 칩 */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.chip.blue { background: var(--info-bg); color: var(--primary-press); }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; }

/* 목록 */
.list { display: grid; }
.item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 4px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .t { font-weight: 600; } .item .s { color: var(--muted); font-size: 13px; }
.item.noselect { grid-template-columns: 1fr auto; }
.item .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-size: 14px; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--info-bg); color: var(--ink2); font-size: 14px; }
.notice.warn { background: var(--warn-bg); } .notice.bad { background: var(--bad-bg); color: var(--bad); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; background: var(--soft); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl-wrap { overflow-x: auto; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 130px; }
.bar { display: grid; gap: 4px; justify-items: center; align-content: end; height: 100%; font-size: 12px; color: var(--muted); }
.bar i { display: block; width: 100%; max-width: 44px; background: var(--primary); border-radius: 6px 6px 0 0; min-height: 2px; }
.bar b { color: var(--ink); font-weight: 600; }
.copybox { white-space: pre-wrap; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 14px; }
.parse-row { display: grid; grid-template-columns: auto 90px minmax(0, 1fr) 72px; gap: 8px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.parse-row:first-child { border-top: 0; }
.parse-row .raw { grid-column: 2 / -1; font-size: 12px; color: var(--muted); }
.parse-row .flags { grid-column: 2 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.sticky-bar { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 10px 0; margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* 모달·토스트 */
.overlay { position: fixed; inset: 0; background: rgba(20, 20, 18, .45); display: grid; place-items: center; padding: 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--bg); border-radius: 14px; width: 100%; max-width: 520px; padding: 20px; display: grid; gap: 14px; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal.wide { max-width: 720px; }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 60; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; padding: 11px 14px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.bad { background: var(--bad); } .toast.good { background: var(--good); }

/* 휴대폰 */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 14px 14px calc(88px + env(safe-area-inset-bottom, 0px)); }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .bottom-nav button { position: relative; border: 0; background: none; padding: 10px 2px 9px; font-size: 12px; color: var(--muted); cursor: pointer; display: grid; gap: 2px; justify-items: center; min-height: 54px; }
  .bottom-nav button[aria-current="page"] { color: var(--primary-press); font-weight: 700; }
  .bottom-nav .ico { font-size: 19px; line-height: 1; }
  .bottom-nav .badge { position: absolute; top: 4px; left: 54%; }
  h1 { font-size: 20px; }
  .item { grid-template-columns: auto 1fr; }
  .item .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .item.noselect { grid-template-columns: 1fr; }
  .parse-row { grid-template-columns: auto 80px 1fr; }
  .parse-row .qtywrap { grid-column: 2 / -1; }
  .code-input { font-size: 28px; max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
