:root {
  --bg: #f4f6f9;
  --card: #fff;
  --line: #e3e7ee;
  --text: #1d2433;
  --muted: #7a8394;
  --accent: #2563eb;
  --accent-soft: #eaf1ff;
  --head: #1f2937;
  --ok: #16a34a;
  --err: #dc2626;
  --fill: #fffbe6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}
main { max-width: 900px; margin: 0 auto; padding: 16px 16px 96px; }
h1 { font-size: 22px; margin: 8px 0 16px; display: flex; align-items: center; gap: 10px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h2 small { font-weight: normal; color: var(--muted); font-size: 12px; margin-left: 6px; }
.step-no { font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 99px; }
.muted { color: var(--muted); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.center { text-align: center; padding: 40px 16px; }
.center h1 { justify-content: center; }
.check { width: 56px; height: 56px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 30px; line-height: 56px; margin: 0 auto; }

input, select, textarea {
  font: inherit; color: inherit; width: 100%; min-width: 0;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input.filled { background: var(--fill); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label input { color: var(--text); font-size: 15px; }

button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: #fff; padding: 8px 14px; white-space: nowrap; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; padding: 11px 28px; }
button.primary:disabled { opacity: .6; }
button.ghost { background: #f5f6f8; }
button.outline { color: var(--accent); border-color: var(--accent); background: #fff; font-size: 13px; padding: 6px 10px; }
button.icon { width: 42px; flex: none; padding: 8px 0; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { background: #f5f6f8; }
.seg button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.seg.small button { padding: 5px 12px; font-size: 14px; }
#customerTypes { gap: 3px; }
#customerTypes button { padding: 8px 11px; }

/* 상품표 */
#productList { margin-top: 10px; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }
table.products { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 14px; }
.products th { background: var(--head); color: #fff; font-weight: 600; padding: 7px 6px; text-align: center; }
.products td { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: center; }
.products td.pname { text-align: left; }
.products td.cash { font-weight: 700; }
.products tbody tr { cursor: pointer; }
.products tbody tr:hover { background: #f8fafc; }
.products tbody tr.sel { background: #fff59d; }
.products .chk { width: 34px; }
.products input { width: auto; }

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; align-items: center; gap: 10px;
  padding: 10px max(16px, calc((100vw - 900px) / 2 + 16px));
}
.bottom-bar .muted { margin-right: auto; }

/* 2단계 폼 */
.row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.lbl { width: 96px; flex: none; font-weight: 600; font-size: 14px; padding-top: 8px; }
.val { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.inline, .val.inline { display: flex; flex-direction: row; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline > input, .inline > select { flex: 1 1 140px; }
.inline.spread { justify-content: space-between; }
.sublbl { font-size: 13px; font-weight: 600; white-space: nowrap; }
#phoneCarrier { flex: 0 1 120px; }
.guide { background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 6px 0; }
.postcode { height: 420px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 6px 0; }

.docs { display: flex; flex-wrap: wrap; gap: 8px; }
.doc {
  flex-direction: row; align-items: center; gap: 8px; cursor: pointer;
  border: 1.5px dashed #c5ccd8; border-radius: 8px; padding: 8px 12px; color: var(--text);
}
.doc:hover { border-color: var(--accent); }
.doc-name { font-weight: 600; font-size: 14px; }
.doc-status { font-size: 12px; color: var(--muted); }
.doc.ok { border-style: solid; border-color: var(--ok); background: #f0fdf4; }
.doc.ok .doc-status { color: var(--ok); font-weight: 600; }
.doc.err { border-color: var(--err); }
.doc.err .doc-status { color: var(--err); }

.modal { position: fixed; inset: 0; z-index: 30; background: rgba(15, 23, 42, .5); display: grid; place-items: center; padding: 16px; }
.modal-box { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; }
.notice-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.notice { flex-direction: row; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 14px; cursor: pointer; }
.notice input { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.notice.on { border-color: var(--accent); background: var(--accent-soft); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions .primary:disabled { background: #9db6f3; border-color: #9db6f3; cursor: not-allowed; }
#orderProduct, #memo { resize: vertical; }

.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 20;
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; max-width: calc(100% - 32px);
}

@media (max-width: 640px) {
  .grid3 { grid-template-columns: 1fr; }
  .row { flex-direction: column; gap: 6px; }
  .lbl { width: auto; padding-top: 0; }
  .products { font-size: 12px; }
  .products th, .products td { padding: 6px 3px; }
}
