/* 견적서 문서 + 편집기 */
.qdoc { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 28px 24px; font-size: 14px; color: var(--ink); }
@media (min-width: 760px) { .qdoc { padding: 40px 44px; } }
.qd-head { display: flex; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 16px; }
.qd-kicker { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--brand); letter-spacing: .08em; }
.qd-title { font-size: 24px; font-weight: 800; margin: 0; }
.qd-meta { margin: 0; display: grid; gap: 2px; font-size: 13px; }
.qd-meta div { display: flex; gap: 10px; }
.qd-meta dt { color: var(--muted); width: 64px; }
.qd-meta dd { margin: 0; font-variant-numeric: tabular-nums; }
.qd-parties { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 640px) { .qd-parties { grid-template-columns: 1fr 1fr; } }
.qd-parties b { display: block; font-size: 16px; }
.qd-parties span { display: block; color: var(--ink-2); font-size: 13px; }
.qd-label { margin: 0 0 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.qd-total { padding: 18px 0; border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.qd-total p { margin: 0; font-weight: 650; }
.qd-total small { color: var(--muted); font-weight: 500; }
.qd-total b { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.qd-total span { color: var(--ink-2); font-size: 13px; }
.qd-items { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13.5px; }
.qd-items th { text-align: left; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--ink); padding: 8px 6px; font-weight: 650; }
.qd-items td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.qd-items .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qd-sum { margin: 14px 0 0 auto; max-width: 320px; display: grid; gap: 4px; }
.qd-sum div { display: flex; justify-content: space-between; gap: 12px; }
.qd-sum dt { color: var(--ink-2); }
.qd-sum dd { margin: 0; font-variant-numeric: tabular-nums; }
.qd-sum .qd-grand { border-top: 2px solid var(--ink); padding-top: 6px; margin-top: 4px; font-weight: 800; font-size: 16px; }
.qd-note { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.qd-note p { margin: 0; }
.qd-foot { margin-top: 24px; font-size: 11.5px; color: var(--faint); }
@media (max-width: 560px) {
  .qd-items thead { display: none; }
  .qd-items, .qd-items tbody, .qd-items tr { display: block; }
  .qd-items tr { display: grid; grid-template-columns: 22px 1fr auto; gap: 0 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .qd-items td { border: 0; padding: 0; }
  .qd-items td:nth-child(1) { grid-row: 1 / span 3; color: var(--muted); }
  .qd-items td:nth-child(2) { font-weight: 650; }
  .qd-items td:nth-child(3) { grid-column: 2; color: var(--muted); font-size: 12.5px; }
  .qd-items td:nth-child(4) { grid-column: 2; text-align: left; color: var(--ink-2); }
  .qd-items td:nth-child(4)::after { content: ' ×'; }
  .qd-items td:nth-child(5) { grid-column: 2; grid-row: 3; text-align: left; }
  .qd-items td:nth-child(6) { grid-column: 3; grid-row: 1; font-weight: 700; }
}
@media print {
  body { background: #fff !important; }
  .sample-bar, .top, .no-print, .toast, .side, .back, .page-h, .v-act { display: none !important; }
  .qdoc { border: 0; padding: 0; }
  .main { padding: 0 !important; }
  .v-grid { display: block !important; }
}

/* 편집기 */
.ed { display: grid; gap: 16px; }
.ed .card .h3 { margin-bottom: 14px; }
.ed-two { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 760px) { .ed-two { grid-template-columns: 1fr 1fr; } .ed-two .wide { grid-column: 1 / -1; } }
.items-ed { width: 100%; border-collapse: collapse; }
.items-ed th { text-align: left; font-size: 12.5px; color: var(--muted); padding: 0 6px 6px 0; font-weight: 650; }
.items-ed td { padding: 4px 6px 4px 0; vertical-align: top; }
.items-ed input, .items-ed select { min-height: 40px; font-size: 15px; padding: 6px 8px; }
.items-ed .c-qty { width: 84px; } .items-ed .c-unit { width: 74px; } .items-ed .c-price { width: 120px; } .items-ed .c-amt { width: 120px; text-align: right; font-variant-numeric: tabular-nums; padding-top: 12px; font-weight: 650; }
.items-ed .c-del button { border: 0; background: none; color: var(--muted); font-size: 20px; width: 40px; height: 40px; }
.items-ed tr.bad input.bad { border-color: var(--danger); background: var(--danger-soft); }
.items-ed .row-err { color: var(--danger); font-size: 12.5px; padding: 0 0 6px; }
@media (max-width: 759px) {
  .items-ed thead { display: none; }
  .items-ed, .items-ed tbody { display: block; }
  .items-ed tr.it { display: grid; grid-template-columns: 1fr 1fr 1.3fr 40px; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .items-ed tr.it td { padding: 0; width: auto !important; min-width: 0; }
  .items-ed .c-name { grid-column: 1 / 4; } .items-ed .c-del { grid-column: 4; grid-row: 1; }
  .items-ed .c-spec { grid-column: 1 / -1; }
  .items-ed .c-qty { grid-column: 1; } .items-ed .c-unit { grid-column: 2; } .items-ed .c-price { grid-column: 3 / 5; }
  .items-ed .c-amt { grid-column: 1 / -1; text-align: right; padding-top: 0; }
  .items-ed tr.row-err-tr { display: block; }
}
.ed-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ed-add select { width: auto; max-width: 100%; }
.ed-sum { display: grid; gap: 6px; max-width: 360px; margin-left: auto; margin-top: 16px; font-variant-numeric: tabular-nums; }
.ed-sum div { display: flex; justify-content: space-between; gap: 12px; }
.ed-sum .grand { font-size: 18px; font-weight: 800; border-top: 2px solid var(--ink); padding-top: 8px; }
.ed-bar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 10px; align-items: center; justify-content: flex-end; z-index: 5; }
.ed-bar .total-mini { margin-right: auto; font-weight: 750; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.seg label { display: inline-flex; align-items: center; padding: 0 12px; min-height: 40px; font-size: 14px; cursor: pointer; border-left: 1px solid var(--line-2); }
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:has(input:checked) { background: var(--ink); color: #fff; }

/* 보기 화면 */
.v-grid { display: grid; gap: 16px; }
@media (min-width: 1040px) { .v-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .side { position: sticky; top: 76px; } }
.side { display: grid; gap: 12px; }
.side .card { padding: 18px; }
.st-big { font-size: 22px; font-weight: 800; }
.v-act { display: grid; gap: 8px; margin-top: 12px; }
.v-act .btn { width: 100%; }
.link-box { display: flex; gap: 6px; }
.link-box input { font-size: 13px; }
.flag { font-size: 13px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--paper); margin: 8px 0 0; }
.flag.good { background: var(--ok-soft); color: var(--ok); font-weight: 650; }
.flag.warn { background: var(--warn-soft); color: var(--warn); }
.fam { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.fam li { padding: 6px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.fam li.cur { font-weight: 750; }
.cat-table input, .cat-table select { min-height: 38px; font-size: 14px; padding: 4px 8px; }
.s-보냄 { background: var(--brand-soft); color: var(--brand); }
.s-수정요청 { background: var(--warn-soft); color: var(--warn); }
.s-완료 { background: #f1f1f3; color: var(--ink-2); }
.s-취소 { background: #f1f1f3; color: var(--faint); }
.s-작성중 { background: #fff; border: 1px dashed var(--line-2); }

.ed-two > *, .d-grid > *, .v-grid > * { min-width: 0; }
.seg { flex-wrap: wrap; max-width: 100%; }
.seg label { flex: 1 1 auto; justify-content: center; }
input[type=date] { min-width: 0; max-width: 100%; }
.ed { grid-template-columns: minmax(0, 1fr); }
.ed > * { min-width: 0; }
