/* 발주판 — 큰 글씨·큰 버튼, 폰과 PC 모두 */
:root {
  --navy: #1f3864; --navy-2: #2b4a80; --ink: #1a1d23; --sub: #5f6670; --line: #dfe3ea;
  --soft: #f3f6fb; --bg: #ffffff; --green: #2e7d32; --green-bg: #e8f5e9; --red: #c0392b;
  --red-bg: #fdecea; --amber: #b26a00; --amber-bg: #fff4e0; --input: #fffaf0; --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-size: 17px; line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif;
}
a { color: var(--navy-2); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* 상단 */
.top { background: var(--navy); color: #fff; }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.brand { font-weight: 800; font-size: 19px; color: #fff; text-decoration: none; white-space: nowrap; }
.brand small { font-weight: 500; opacity: .8; margin-left: 6px; font-size: 14px; }
.top .who { margin-left: auto; font-size: 14px; opacity: .9; white-space: nowrap; }
.top form { margin: 0; }
.top .link-btn { background: none; border: 1px solid rgba(255,255,255,.5); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 14px; cursor: pointer; }
.nav { background: #eef2f8; border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; gap: 6px; overflow-x: auto; padding-top: 8px; padding-bottom: 8px; }
.nav a { white-space: nowrap; text-decoration: none; color: var(--ink); padding: 8px 14px; border-radius: 99px; font-weight: 600; font-size: 16px; }
.nav a.on { background: var(--navy); color: #fff; }
.support { background: var(--amber-bg); color: var(--amber); font-size: 14px; }
.support .wrap { display: flex; align-items: center; gap: 10px; padding-top: 6px; padding-bottom: 6px; }

main { padding: 20px 0 48px; }
h1 { font-size: 26px; margin: 4px 0 14px; letter-spacing: -0.3px; }
h2 { font-size: 20px; margin: 26px 0 10px; }
.lead { color: var(--sub); margin: -6px 0 18px; }
.muted { color: var(--sub); }
.small { font-size: 14px; }

/* 알림 */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; }
.flash.ok { background: var(--green-bg); color: var(--green); }
.flash.error { background: var(--red-bg); color: var(--red); }
.flash.info { background: var(--soft); color: var(--navy); }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px;
  border-radius: 10px; border: 1px solid var(--navy); background: var(--navy); color: #fff; font-size: 17px; font-weight: 700;
  text-decoration: none; cursor: pointer; font-family: inherit; white-space: nowrap; }
.btn.line { background: #fff; color: var(--navy); }
.btn.ghost { background: none; border-color: var(--line); color: var(--ink); }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn.big { min-height: 60px; font-size: 19px; width: 100%; }
.btn.sm { min-height: 38px; font-size: 15px; padding: 0 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
/* 화면 머리 줄(.row)이 휴대폰에서 여러 줄로 넘어가도 다음 내용과 붙거나 겹치지 않게 */
.row + .lead { margin-top: 10px; }
.grid2 > * { min-width: 0; }  /* 좁은 화면에서 입력란이 칸 밖으로 넘치지 않게 */
.row + .row, .row + .card, .row + .flash, .row + .steps, .row + table { margin-top: 12px; }
h1 small { font-size: 0.6em; font-weight: 600; }

/* 타일 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.tile { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink); background: #fff; }
.tile:hover { border-color: var(--navy-2); }
.tile .k { font-size: 15px; color: var(--sub); font-weight: 600; }
.tile .v { font-size: 30px; font-weight: 800; margin-top: 4px; }
.tile .d { font-size: 14px; color: var(--sub); margin-top: 2px; }
.tile.todo { background: var(--amber-bg); border-color: #f1d3a0; }
.tile.wait { background: var(--soft); }

/* 연휴 안내 띠 */
.break-banner { margin: 12px 0; padding: 12px 16px; border-radius: 12px; background: #fff0f0; color: #a12a1f; font-weight: 800; border: 1px solid #f3c4bf; }

/* 카드·표 */
.card.breakcard { background: var(--amber-bg); border-color: #f1d3a0; }
.card.breakcard h2 { color: var(--amber); }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; background: #fff; }
.card h2:first-child { margin-top: 0; }
table.list { width: 100%; border-collapse: collapse; }
.list th, .list td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.list th { font-size: 14px; color: var(--sub); font-weight: 700; background: var(--soft); }
.list td.num, .list th.num { text-align: right; white-space: nowrap; }
.list td.num details[open] { white-space: normal; text-align: left; }  /* 숫자 칸 안의 '고치기' 입력란은 줄바꿈 */
.list tr.off td { color: #9aa1ab; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 13px; font-weight: 700; background: var(--soft); color: var(--navy); white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.diff-up { color: var(--red); font-weight: 700; }
.diff-down { color: var(--navy-2); font-weight: 700; }

/* 입력 */
label.f { display: block; font-weight: 700; margin: 14px 0 6px; }
label.f .hint { font-weight: 500; color: var(--sub); font-size: 14px; margin-left: 6px; }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 48px; border: 1px solid #c9d0db; border-radius: 10px; padding: 10px 12px; font-size: 17px;
  font-family: inherit; background: #fff; }
input.money { text-align: right; background: var(--input); }
input::placeholder { color: #b9c0ca; }
textarea { min-height: 80px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; font-weight: 600; }
.choices input { width: 20px; height: 20px; }
.actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.copybox { display: flex; gap: 8px; }
.copybox input { font-size: 15px; background: var(--soft); }

/* 로그인·가운데 화면 */
.center { max-width: 440px; margin: 40px auto; padding: 0 16px; }
.center .logo { font-size: 30px; font-weight: 900; color: var(--navy); margin-bottom: 4px; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.pinpad button { min-height: 68px; font-size: 26px; font-weight: 800; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.pindots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 6px; }
.pindots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--navy); }
.pindots span.on { background: var(--navy); }
.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }

/* 거래처 화면 */
.cust-head { background: var(--navy); color: #fff; padding: 18px 16px; }
.cust-head .co { font-size: 15px; opacity: .85; }
.cust-head .me { font-size: 24px; font-weight: 800; }
.deadline { margin: 14px 0; padding: 14px 16px; border-radius: 12px; background: var(--amber-bg); color: var(--amber); font-weight: 700; }
.deadline.next { background: var(--soft); color: var(--navy); }
.prod { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.prod .nm { font-weight: 700; font-size: 18px; }
.prod .sp { color: var(--sub); font-size: 15px; }
.prod .pr { margin-left: auto; font-weight: 800; font-size: 19px; white-space: nowrap; }

/* 거래처 발주 화면: 큰 사진·큰 ＋− 버튼, 아래에 합계와 버튼 고정 */
.cust { max-width: 600px; }
.cust h1 { margin-top: 18px; }
.pcard { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 6px; border-bottom: 1px solid var(--line); border-radius: 10px; }
.pcard.on { background: #f2f7ff; }
.pcard .ph { width: 60px; height: 60px; border-radius: 12px; background: var(--soft); overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; color: var(--navy); flex: none; }
.pcard .ph .spec { font-size: 17px; letter-spacing: -0.5px; }
.pcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.pcard .info { flex: 1 1 100px; min-width: 0; }
.pcard .nm { font-weight: 800; font-size: 19px; line-height: 1.3; word-break: keep-all; overflow-wrap: anywhere; }
.pcard .sp { color: var(--sub); font-size: 16px; }
.pcard .pr { font-weight: 800; font-size: 18px; margin-top: 2px; white-space: nowrap; }
.step { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.step button { width: 52px; height: 52px; border-radius: 14px; font-size: 30px; font-weight: 800; line-height: 1; border: 2px solid var(--navy); background: #fff; color: var(--navy); cursor: pointer; touch-action: manipulation; }
.step .plus { background: var(--navy); color: #fff; }
.step input { width: 50px; min-height: 52px; height: 52px; text-align: center; font-size: 24px; font-weight: 800; padding: 0; }
.bar { position: sticky; bottom: 0; background: #fff; border-top: 2px solid var(--line); padding: 12px 0 calc(14px + env(safe-area-inset-bottom)); display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.bar .sum { flex: 1; font-size: 17px; }
.bar .sum b { font-size: 21px; }
.bar .btn.big { width: auto; min-width: 150px; }
.again { flex-direction: column; margin: 4px 0 14px; height: auto; padding: 10px 16px; }
.again small { display: block; font-weight: 500; font-size: 14px; color: var(--sub); white-space: normal; }
.open-order { display: flex; justify-content: space-between; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--green-bg); color: var(--ink); text-decoration: none; margin-bottom: 10px; font-size: 16px; }
.open-order.past { background: var(--soft); }
.open-order .go { font-weight: 800; white-space: nowrap; color: var(--navy); }
.big-date { font-size: 20px; }
.list.review td { font-size: 17px; }
.list.review tr.sub td { color: var(--sub); }
.list.review tr.grand td { font-weight: 800; font-size: 20px; border-bottom: 0; }
.done-mark { margin: 18px 0 0; padding: 18px; border-radius: 14px; background: var(--green-bg); color: var(--green); font-size: 22px; font-weight: 800; text-align: center; }
.cust .actions .btn.big { flex: 1; }

@media (max-width: 700px) {
  body { font-size: 16px; }
  h1 { font-size: 23px; }
  .grid2 { grid-template-columns: 1fr; }
  .top .who { display: none; }
  table.list.stack thead { display: none; }
  table.list.stack, .list.stack tbody, .list.stack tr, .list.stack td { display: block; width: 100%; }
  .list.stack tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 6px 4px; }
  .list.stack td { border: 0; padding: 6px 10px; text-align: left !important; }
  .list.stack td[data-k]::before { content: attr(data-k); display: block; font-size: 13px; color: var(--sub); font-weight: 700; }
  /* 목록 화면: 한 줄 요약 카드 */
  .list.compact tr { padding: 12px 14px; }
  .list.compact td { display: inline; padding: 0; font-size: 15px; color: var(--sub); }
  .list.compact td:first-child { display: block; font-size: 18px; color: var(--ink); margin-bottom: 4px; }
  .list.compact td[data-k]::before { display: none; }
  .list.compact td:not(:first-child):not(.num) + td:not(.num)::before { content: " · "; display: inline; font-weight: 400; }
  .list.compact td.num.go { display: none; }
}
.m-only { display: none; }
.list.compact td.m-only::before { content: none !important; }  /* 폰 요약 칸 앞에는 점을 찍지 않음 */
@media (max-width: 700px) { .pc-only { display: none !important; } .m-only { display: revert; } }
@media (max-width: 700px) {
  /* 이름·설명 두 칸짜리 표: 폰에서는 이름을 위에, 설명을 아래에 */
  table.list.kv tr, table.list.kv td { display: block; width: 100%; }
  table.list.kv td:first-child { padding-bottom: 0; border-bottom: 0; }
  /* A4 인쇄용 포장 목록을 폰으로 볼 때는 칸 폭을 내용에 맞게 */
  .pack-lines { table-layout: auto; }
  .pack-lines col { width: auto !important; }
}

/* 공장 주문 화면 */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.sheet-head h1 { margin: 0; }
.sum-table td, .sum-table th { font-size: 18px; padding: 10px 8px; }
.sum-table td.big { font-size: 22px; font-weight: 800; }
.sum-table tfoot td { font-weight: 800; border-top: 2px solid var(--ink); }
.sum-table .chk { width: 54px; text-align: center; }
.sum-table .box { display: inline-block; width: 22px; height: 22px; border: 2px solid var(--ink); border-radius: 4px; }

/* 오늘 출고: 큰 번호 버튼 */
.steps { display: grid; gap: 12px; max-width: 720px; }
.step-btn { display: flex; align-items: center; gap: 16px; padding: 18px; border: 2px solid var(--navy); border-radius: 16px; text-decoration: none; color: var(--ink); background: #fff; }
.step-btn .no { flex: none; width: 56px; height: 56px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 28px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.step-btn .t { flex: 1; font-size: 22px; font-weight: 800; }
.step-btn .t small { display: block; font-size: 15px; font-weight: 500; color: var(--sub); margin-top: 2px; }
.step-btn .t small.warn { color: var(--red); font-weight: 700; }
.step-btn.done { border-color: var(--green); background: var(--green-bg); }
.step-btn.done .no { background: var(--green); }
.step-btn form { margin: 0; }
/* 버튼이 있는 단계 카드: 글이 좁아지면 버튼을 글 아래로 (휴대폰에서 글자가 세로로 쪼개지지 않게) */
.step-btn { flex-wrap: wrap; }
.step-btn .t { flex: 1 1 200px; min-width: 0; }
.step-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 700px) { .step-actions { flex-basis: 100%; } }

/* 포장 목록 */
.pack-group { margin: 18px 0 8px; padding: 6px 10px; background: var(--soft); border-radius: 8px; font-size: 18px; }
.pack-order { border: 1px solid var(--ink); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; break-inside: avoid; page-break-inside: avoid; }
.pack-order.late { border: 3px solid var(--amber); }
.pack-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 18px; }
.pack-head .seq { font-size: 26px; font-weight: 900; min-width: 36px; }
.pack-head .box, .pack-lines .box { display: inline-block; width: 22px; height: 22px; border: 2px solid var(--ink); border-radius: 4px; }
.pack-lines { table-layout: fixed; }
.pack-lines td { padding: 6px; font-size: 16px; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.pack-lines td.big { font-size: 20px; font-weight: 800; }
.pack-lines .chk { width: 34px; }
.pack-lines tr.lot-split td { background: #fff4e0; }

.warn { color: var(--red); font-weight: 700; }

/* 명세서 화면 (/s/<열쇠>). PDF는 templates/statement/pdf.html에 따로 */
.wrap.cust.st-page { max-width: 1040px; }
.st { margin: 8px 0 16px; }
.st-lines td:first-child { min-width: 170px; }
.st-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.st-title { font-size: 26px; font-weight: 900; letter-spacing: 6px; }
.st-meta { color: var(--sub); }
.st-issuer th, .st-sum th, .st-rec th { text-align: left; font-weight: 700; color: var(--sub); padding: 2px 10px 2px 0; white-space: nowrap; }
.st-issuer td { padding: 2px 0; }
.st-to { font-size: 20px; margin: 14px 0 8px; }
.st-lines { width: 100%; border-collapse: collapse; }
.st-lines th, .st-lines td { border-bottom: 1px solid var(--line); padding: 8px 6px; font-size: 15px; text-align: left; }
.st-lines th { background: var(--soft); color: var(--sub); font-weight: 700; white-space: nowrap; }
.st-lines .num { text-align: right; white-space: nowrap; }
.st .vat { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 0 4px; color: var(--sub); font-weight: 600; }
.st-sum { margin: 12px 0 0 auto; }
.st-sum td { padding: 2px 0 2px 16px; text-align: right; white-space: nowrap; }
.st-sum .grand th, .st-sum .grand td { font-size: 22px; font-weight: 900; color: var(--ink); }
.st-note { color: var(--sub); font-size: 14px; }
.st-rec { border: 1px solid var(--line); border-radius: 12px; border-collapse: separate; padding: 8px 12px; margin-top: 10px; box-sizing: border-box; }
.st-rec td { text-align: right; padding: 2px 14px 2px 0; white-space: nowrap; }
.st-rec .grand th, .st-rec .grand td { font-size: 20px; font-weight: 900; color: var(--ink); border-top: 1px solid var(--line); padding-top: 6px; }
.st-norec { color: var(--sub); margin-top: 10px; }
.st-bank { font-weight: 700; margin-top: 10px; }
pre.msg { white-space: pre-wrap; font-family: inherit; font-size: 14px; background: var(--soft); padding: 8px 10px; border-radius: 8px; margin: 6px 0 0; }
@media (max-width: 700px) {
  /* 폰: 상품 한 줄 = 카드 한 장 (빈 칸은 숨김) */
  .st-title { font-size: 22px; letter-spacing: 3px; }
  .st-lines thead { display: none; }
  .st-lines, .st-lines tbody, .st-lines tr { display: block; width: 100%; }
  .st-lines tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 8px 12px; }
  .st-lines td { display: inline-block; border: 0; padding: 2px 12px 2px 0; text-align: left !important; }
  .st-lines td:first-child { display: block; font-size: 17px; min-width: 0; }
  .st-lines td:empty { display: none; }
  .st-lines td[data-k]:not(:first-child)::before { content: attr(data-k) " "; color: var(--sub); font-size: 13px; font-weight: 700; }
  .st-sum, .st-rec { margin-left: 0; width: 100%; }
}

/* 인쇄 (A4): 메뉴·버튼 숨기고 표만 */
@page { size: A4 portrait; margin: 12mm; }
@media print {
  .top, .nav, .support, .no-print, .flash { display: none !important; }
  main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  body { font-size: 13pt; }
  .sum-table td, .sum-table th { font-size: 13pt; padding: 6px 6px; }
  .sum-table td.big { font-size: 16pt; }
  .sum-table tr { break-inside: avoid; }
  .pack-order { break-inside: avoid; }
  .pack-lines td { font-size: 11pt; padding: 3px 6px; }
  .pack-head { font-size: 13pt; }
  .badge { border: 1px solid #999; }
  .st-lines th, .st-lines td { font-size: 9.5pt; padding: 3px 4px; border: 0.6pt solid #888; }
  .st-title { font-size: 20pt; }
}

/* 2단계 인증 */
/* QR: SVG는 viewBox만 있어 이 크기에 맞춰 줄어든다(잘리지 않음). 크기를 바꾸면 QR 시험도 같은 크기로 그린다. */
.qr svg { width: 240px; height: 240px; max-width: 100%; display: block; margin: 8px 0; background: #fff; }
.secret-text { font-family: ui-monospace, Menlo, monospace; font-size: 18px; letter-spacing: 1px; word-break: break-all; }
/* 복구 코드: 번호를 글 안에 그려서(목록 번호가 옆 칸 코드와 겹치지 않게) 폭에 맞춰 1~4칸 */
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 24px; margin: 0; padding: 0;
  list-style: none; counter-reset: code; font-family: ui-monospace, Menlo, monospace; font-size: 21px; font-weight: 700; }
.codes li { counter-increment: code; white-space: nowrap; }
.codes li::before { content: counter(code) "."; display: inline-block; min-width: 2.4em; font-weight: 400; opacity: .55; }
