/* 견적 · 판매 · 발주 · 입고 · 반품 + 견적서/발주서 인쇄 */

/* 목록 */
.month { display: flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.month button { border: 0; background: none; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 18px; }
.month button:hover { background: var(--bg); }
.month b { min-width: 110px; text-align: center; }
.dlist td { padding-top: 14px; padding-bottom: 14px; }
.foot b { color: var(--text); font-size: 20px; margin-left: 6px; }
.tag.ch-ecommerce { background: #e8f0fe; color: var(--accent); }
.tag.ch-store { background: #e3f6ec; color: var(--plus); }
.tag.ch-quote { background: #fff3d6; color: #9a6b00; }
.tag.ch-partner { background: #f0e9fd; color: #7a4bd8; }
.chip.ok { background: #e3f6ec; color: var(--plus); }
.ia { border: 0; background: none; width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: #8a8a8e; font-size: 18px; }
.ia:hover { background: var(--bg); color: var(--text); }
.ia.plus { color: var(--accent); font-size: 20px; }
.ia.box { border: 1px solid var(--line); width: 40px; height: 40px; border-radius: 10px; background: #fff; }
.ia.empty-box { border-style: dashed; color: #c7c7cc; cursor: default; }

/* 입력 화면 */
.big-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.big-tabs button { height: 70px; border: 1px solid var(--line); background: #fff; border-radius: 14px; font-size: 17px; font-weight: 700; cursor: pointer; }
.big-tabs button.on { border: 2px solid var(--text); }
.big-tabs button:first-child.on[data-t="file"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.doc-top { display: grid; grid-template-columns: 1fr; gap: 16px; }
.doc-top.with-photo { grid-template-columns: 1fr 340px; }
.doc-top .panel { margin-bottom: 16px; }
.doc-photo { padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.doc-photo img { width: 100%; max-height: 460px; object-fit: contain; border-radius: 8px; background: var(--bg); }
.form.grid2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 36px; }
.form.grid2 .f { grid-template-columns: 88px 1fr; }
.doc-form .form:not(.grid2) { max-width: 900px; }
.sw-line { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.sw-line.keep { margin: 14px 8px 0; }
.pp { position: relative; }
.picked { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--accent); background: #f5f8ff; border-radius: 10px; padding: 9px 12px; min-height: 46px; }
.picked b { font-size: 17px; }
.picked .tag { background: #f0e9fd; color: #7a4bd8; }
.picked .x { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--muted); display: flex; }
.adder { position: relative; }
.finder-pop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 360px; overflow: auto; padding: 6px; }
.finder-pop button { display: flex; width: 100%; justify-content: space-between; gap: 12px; align-items: center; border: 0; background: none; padding: 11px 12px; border-radius: 8px; text-align: left; cursor: pointer; }
.finder-pop button:hover { background: var(--bg); }
.finder-pop small { color: var(--muted); white-space: nowrap; }
.finder-pop .empty { padding: 14px; }

.src-tag { display: inline-block; background: #f0e9fd; color: #7a4bd8; font-weight: 700; font-size: 13px; padding: 4px 12px; border-radius: 99px; margin-bottom: 8px; }
table.lines th { white-space: nowrap; }
table.lines td { padding-top: 8px; padding-bottom: 8px; vertical-align: middle; }
table.lines tr.red td { background: #fdf1f0; }
table.lines tr.yellow td { background: #fffbea; }
table.lines tr.red .ln { color: inherit; }
table.lines td.st { white-space: nowrap; color: #48484a; }
table.lines td.st small { display: block; font-size: 12px; font-weight: 700; }
table.lines td.amt { white-space: nowrap; min-width: 90px; }
table.lines .q-in, table.lines .p-in { display: inline-block; }
table.lines .q-in { width: 90px; text-align: right; margin: 0; padding: 9px 12px; }
table.lines .p-in { width: 110px; text-align: right; margin: 0; padding: 9px 4px; border-color: transparent; background: transparent; }
table.lines .p-in:hover, table.lines .p-in:focus { border-color: var(--line); background: #fff; }
table.lines .ln-in { margin: 0; padding: 8px 10px; max-width: 360px; }
table.lines .hint-s { display: block; color: var(--muted); font-size: 11px; margin-top: -2px; }
table.lines th.acts, table.lines td.acts { text-align: right; white-space: nowrap; width: 1%; }
table.lines td.acts .grip { padding: 0 6px; }
table.lines tr.add-row td { border-bottom: 0; padding-top: 12px; }
table.lines #add-in { margin: 0; border: 1.5px dashed var(--line); background: #fcfcfb; padding: 13px 16px; }
table.lines #add-in:focus { border-style: solid; border-color: var(--accent); background: #fff; }
.seg.mini button { padding: 5px 12px; font-size: 14px; }
.sum-line { display: flex; align-items: baseline; justify-content: flex-end; gap: 12px; margin-top: 18px; color: var(--muted); }
.sum-line b { font-size: 30px; color: var(--text); }
.toast.undo button { border: 0; background: none; color: #8fb4ff; font-weight: 700; margin-left: 14px; cursor: pointer; }
.btn.line.red { border-color: var(--minus); color: var(--minus); }
.cnt { font-style: normal; background: var(--minus); color: #fff; border-radius: 99px; font-size: 12px; padding: 1px 7px; margin-left: 4px; }
.modal.wide { max-width: 640px; }
.doc-pick { display: flex; flex-direction: column; max-height: 60vh; overflow: auto; }
.doc-pick button { display: grid; grid-template-columns: 54px 140px 1fr auto; gap: 10px; align-items: center; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 13px 6px; cursor: pointer; }
.doc-pick button:hover { background: var(--bg); }
.doc-pick small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-pick em { font-style: normal; font-weight: 700; }
.modal textarea { width: 100%; margin: 6px 0 12px; }
.og { display: flex; flex-direction: column; gap: 12px; max-height: 55vh; overflow: auto; margin: 10px 0; }
.og-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.og-box > b { display: block; margin-bottom: 6px; }
.og-sup { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.og-sup select { flex: 1; min-width: 0; }
.og-box .check { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.og-box .check small { margin-left: auto; color: var(--muted); }

/* 눌러서 넣기 */
.tap-row { display: grid; grid-template-columns: 70px 1fr; gap: 12px; align-items: start; margin-bottom: 12px; }
.tap-row > span { color: var(--muted); padding-top: 9px; }
.tap-row > div { display: flex; flex-wrap: wrap; gap: 8px; }
.tchip { border: 1px solid var(--line); background: var(--card); color: inherit; border-radius: 99px; padding: 8px 16px; cursor: pointer; font-size: 15px; }
.tchip.on { background: var(--text); color: #fff; border-color: var(--text); font-weight: 700; }
.tap-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; }
.titem { position: relative; border: 1px solid var(--line); background: var(--card); color: inherit; border-radius: 14px; padding: 16px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: center; font-size: 15px; }
.titem small { color: var(--muted); }
.titem.on { border: 2px solid var(--accent); background: #f5f8ff; }
.titem i { position: absolute; top: -8px; right: -8px; background: var(--accent); color: #fff; font-style: normal; font-weight: 700; border-radius: 99px; min-width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-size: 13px; }

/* 사진 스캔 */
.scan-tiles .htile { height: 220px; }
.scan-tiles .htile b { font-size: 22px; }
.scan-tiles .htile small { color: var(--muted); }

/* 견적서 · 발주서 */
.qdoc { padding: 14mm 12mm; font-size: 10pt; }
.qdoc h1 { text-align: center; font-size: 26pt; letter-spacing: 18pt; margin: 2mm 0 8mm; }
.qdoc table { width: 100%; border-collapse: collapse; }
.qdoc th, .qdoc td { border: 1px solid #000; padding: 1.8mm 2.5mm; }
.qdoc tr:last-child td { border-bottom: 1px solid #000; }
.qdoc th { background: #f2f2f2; font-weight: 700; white-space: nowrap; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.q-top { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; }
.q-box th { width: 26%; text-align: center; }
.q-say { text-align: center; font-weight: 700; height: 14mm; }
.q-co { text-align: center; height: 20mm; font-size: 20pt; }
.q-co img { max-height: 16mm; max-width: 60mm; }
.q-box .ceo { position: relative; }
.q-box .ceo img { position: absolute; right: 2mm; top: 50%; transform: translateY(-50%); height: 15mm; opacity: .9; }
.q-sum { display: flex; justify-content: space-between; border: 2px solid #000; padding: 3mm 4mm; margin: 4mm 0; font-weight: 700; font-size: 12pt; }
.q-lines td { height: 6.2mm; }
.q-lines td.c, .q-lines th { text-align: center; }
.q-lines td.r { text-align: right; }
.q-lines tr.disc td { color: #c00; }
.q-note { margin-top: 4mm; }
.q-note th { width: 18%; height: 16mm; letter-spacing: 3pt; }
.q-note td { vertical-align: top; }

@media (max-width: 760px) {
  .big-tabs { gap: 8px; }
  .big-tabs button { height: 64px; font-size: 14px; padding: 0 6px; }
  .doc-top.with-photo { grid-template-columns: 1fr; }
  .form.grid2 { grid-template-columns: 1fr; }
  .form.grid2 .f, .doc-form .f { grid-template-columns: 72px 1fr; }
  .pc-only { display: none; }
  table.lines .q-in { width: 64px; padding: 8px; }
  table.lines .p-in { width: 80px; }
  table.lines td.acts .grip { display: none; }
  .sum-line b { font-size: 24px; }
  .doc-pick button { grid-template-columns: 46px 1fr auto; }
  .doc-pick small { display: none; }
  .tap-items { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  .qdoc { box-shadow: none; }
}

/* 알림 */
#bell { position: relative; }
#bell .dot { position: absolute; top: 2px; right: 0; background: var(--minus); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; border-radius: 99px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
#bell-pop { min-width: 300px; padding: 6px; }
.alert-row { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-radius: 8px; font-size: 15px; }
.alert-row:hover { background: var(--bg); }

/* 폰: 줄을 카드처럼 (이름 한 줄, 아래에 재고 · 수량 · 단가 · 금액) */
@media (max-width: 760px) {
  #lines { padding: 16px 12px; }
  #lines .scroll-x { overflow: visible; }
  table.lines, table.lines tbody { display: block; }
  table.lines tr:first-child:has(th) { display: flex; justify-content: flex-end; border: 0; }
  table.lines tr:first-child:has(th) th:not(.acts) { display: none; }
  table.lines tr[data-i] { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
  table.lines tr[data-i] td { border: 0; padding: 0; }
  table.lines tr[data-i] td:first-child { flex-basis: 100%; font-weight: 600; }
  table.lines tr.disc td:empty { display: none; }
  table.lines td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); font-weight: 400; text-align: left; }
  table.lines td.amt { margin-left: auto; min-width: 0; }
  table.lines td.acts, table.lines th.acts { display: flex; width: auto; flex-shrink: 0; }
  table.lines td[data-l]:not(.st)::before { text-align: right; }
  table.lines td.acts .ia { width: 28px; }
  table.lines tr.disc td.acts { flex-basis: auto; }
  table.lines tr.add-row { display: block; }
  table.lines tr.add-row td { display: block; padding: 12px 0 0; }
}
.scan-tiles .htile { border: 0; cursor: pointer; width: 100%; }
table.lines .free { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
table.lines .free .ln-in { width: 260px; }
table.lines .free .link-btn { font-size: 13px; color: var(--accent); background: none; border: 0; cursor: pointer; padding: 0; text-decoration: underline; }
.temp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.temp-row small { display: block; color: var(--muted); font-size: 13px; }

/* 발송: 퀵 · 화물 · 택배 + 송장번호 + 사진 */
.ship h3 { margin-top: 0; }
.ship .f { max-width: 640px; }
.ship-ph { display: flex; flex-wrap: wrap; gap: 10px; }
.sp { position: relative; width: 96px; height: 96px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.sp img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; cursor: pointer; }
.sp-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1.5px dashed var(--accent); background: #f5f8ff; color: var(--accent); font-size: 13px; font-weight: 700; cursor: pointer; }
.sp-add i { font-style: normal; font-size: 24px; }
.ship-tag { background: #fff4d6; color: #8a6200; }
@media (max-width: 760px) { .sp { width: 68px; height: 68px; } .ship-ph { gap: 8px; } .ship .seg { flex-wrap: nowrap; } .ship .seg button { padding: 10px 11px; } }
/* ＋ 판매 입력 · ＋ 매입 넣기 큰 칸: 선 그림 + 짧은 이름 */
.big-tabs button { display: flex; align-items: center; justify-content: center; gap: 8px; color: inherit; }
.big-tabs button svg { color: var(--accent); flex: none; }
.big-tabs button.on svg { color: inherit; }
.tab-more { margin: -6px 0 14px; text-align: right; }
.linkish { background: none; border: none; color: var(--muted); font-size: 14px; text-decoration: underline; cursor: pointer; padding: 4px; }
@media (max-width: 760px) { .big-tabs { gap: 6px; } .big-tabs button { flex-direction: column; gap: 4px; height: 76px; font-size: 14px; } }
.temp-row[hidden] { display: none; }
.temp-acts { display: flex; gap: 8px; align-items: center; flex: none; }
.temp-acts { gap: 8px; }
.temp-acts .btn { height: 36px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; border-radius: 9px; white-space: nowrap; }
.temp-acts .temp-set { background: #eef3ff; color: var(--accent); border: 1.5px solid var(--accent) !important; }
.temp-acts .del-temp { width: 36px; padding: 0; background: #fff5f5; color: #d9363e; border: 1.5px solid #d9363e !important; }
.temp-row > span:first-child { min-width: 0; }
.q-lines .q-sub { color: #666; font-size: 0.85em; margin-left: 4px; }

/* 판매 골라서 발주서 */
.pick-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(0,0,0,.08); }
.pick-bar .grow { flex: 1; }
.dlist tr.po-on td { background: #eef3ff; }
.row-pick { width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; }
@media (max-width: 760px) { .pick-bar { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); } .pick-bar .btn.go { flex: 1 1 100%; } }
.row-acts { display: inline-flex; gap: 6px; justify-content: flex-end; }
.ia.box.del-row { color: #d9363e; border-color: #f1b5b8; background: #fff5f5; }
.ia.box.del-row:hover { border-color: #d9363e; }
.pick-bar .red-go { background: #d9363e; border-color: #d9363e; display: inline-flex; align-items: center; gap: 6px; }
/* 엑셀 표 고르기: 한 줄씩 꽉 차게 (제목 · 줄 수 · 예) */
.doc-pick button.tbl-pick { display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: 100%; padding: 14px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; min-width: 0; }
.doc-pick button.tbl-pick:hover { border-color: var(--accent); background: #f5f8ff; }
.doc-pick button.tbl-pick b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-pick button.tbl-pick small { display: block; font-size: 13px; }
/* 폰: 부족한 줄은 줄 전체를 옅게 칠해요 (칸마다 따로 칠하면 얼룩져 보여요) */
@media (max-width: 760px) {
  table.lines tr.red[data-i] { background: #fdf1f0; border-radius: 10px; }
  table.lines tr.yellow[data-i] { background: #fffbea; border-radius: 10px; }
  table.lines tr[data-i] td { background: none !important; }
  table.lines td.amt b { display: block; padding: 9px 0; }
}
/* 눌러서 넣기: 한 단계씩 펼치기 (고른 건 한 줄로 접혀요) */
.tfold { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-bottom: 8px; }
.tfold small { color: var(--muted); width: 56px; flex: none; font-size: 14px; }
.tfold b { flex: 1; min-width: 0; }
.tfold-b { border: 0; background: none; color: var(--accent); font: inherit; font-size: 14px; cursor: pointer; padding: 4px 0 4px 8px; }
.topen { border: 2px solid var(--accent); border-radius: 16px; padding: 14px; margin-bottom: 8px; background: var(--card); }
.tap-q { margin: 0 0 10px; font-weight: 700; font-size: 17px; }
.tap-q small { color: var(--muted); font-weight: 400; font-size: 14px; margin-left: 4px; }
.tap-find { margin: 0 0 10px; width: 100%; }
.tap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tap-grid .tchip { border-radius: 12px; padding: 12px; text-align: center; }
.tmore { display: block; width: 100%; border: 0; background: none; color: var(--accent); font: inherit; font-size: 14px; padding: 10px 0 0; cursor: pointer; }
.tnext { border: 1px dashed var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; color: var(--muted); opacity: .7; }
.topen .tap-items { margin-top: 0; }
@media (max-width: 700px) { .tap-grid { grid-template-columns: 1fr 1fr; } }
.finder-pop button.add-more { justify-content: center; color: var(--accent); font-size: 14px; }
.finder-pop button span em { display: block; font-style: normal; color: var(--muted); font-size: 13px; margin-top: 2px; }
