/* ================================================
   ZioYou ERP - 견적서 빌더 스타일 v3 (quoteBuilder.css)
   ================================================ */

/* ===== 공통 ===== */
.mt6 { margin-top: 6px; }
.qb-na { color: var(--gray-300); }
.qb-red { color: #dc2626 !important; }

/* ===== 카테고리 탭 (기본 무색, 클릭시만 색상) ===== */
.qb-cat-tab {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.qb-cat-tab:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #cbd5e1;
}
.qb-cat-tab.active {
  background: #1e3a5f;
  color: #fff;
  border-color: #1e3a5f;
}

/* ===== 유형 뱃지 (가견적/정식 — 무색) ===== */
.qb-kind-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 1px 6px;
  background: transparent;
}

/* ===== quoteCat 뱃지 (무색) ===== */
.qb-cat-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  color: #64748b;
  padding: 1px 0;
  background: transparent;
}

/* ===== 고객사 검색 드롭다운 ===== */
.qb-cust-search-wrap { position: relative; }
.qb-cust-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--primary-border, #bfdbfe);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}
.qb-cust-item {
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.1s;
  border-bottom: 1px solid #f1f5f9;
}
.qb-cust-item:last-child { border-bottom: none; }
.qb-cust-item:hover { background: var(--primary-bg); }

/* ===== 목록 화면 ===== */
.qb-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}
.qb-empty i { font-size: 48px; margin-bottom: 12px; display: block; }
.qb-empty p { margin-bottom: 16px; font-size: 14px; }

/* 목록 테이블 - 전체 가운데 정렬, 메모 열만 왼쪽 */
.qb-list-tbl { font-size: 12px; }
.qb-list-tbl th,
.qb-list-tbl td { text-align: center; vertical-align: middle; }
.qb-list-tbl td.qb-memo-cell { text-align: left; }
.qb-list-tbl .qb-action-cell { text-align: center; }

/* 핀박기 */
.qb-pin-btn {
  width: 22px; height: 22px;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  background: transparent;
  color: var(--gray-300);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  transform: rotate(45deg);
  display: inline-flex; align-items: center; justify-content: center;
}
.qb-pin-btn:hover { color: #d97706; border-color: #d97706; background: #fffbeb; }
.qb-pin-btn.active { color: #d97706; border-color: #d97706; background: #fef3c7; transform: rotate(0deg); }
/* 핀고정 행: 배경색 없음 — 핀 아이콘으로만 구분 */

/* 상태 셀렉트 */
.qb-status-sel {
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
  outline: none;
}
.qb-status-sel:focus { outline: 2px solid var(--primary); }
.qb-status-sel.qb-st-draft    { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.qb-status-sel.qb-st-approved { background: #dcfce7; color: #166534; border-color: #86efac; }
.qb-status-sel.qb-st-sent     { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.qb-status-sel.qb-st-viewed   { background: #fef9c3; color: #854d0e; border-color: #fde047; }
.qb-status-sel.qb-st-paid     { background: #dc2626; color: #fff;    border-color: #b91c1c; pointer-events:none; opacity:1; }
.qb-status-sel.qb-st-void     { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

/* 입금완료 뱃지 — 빨간색, 선택 불가 */
.qb-st-paid { background: #dc2626; color: #fff; }
/* disabled 상태에서도 색상 유지 */
.qb-status-sel.qb-st-paid:disabled { opacity: 1; cursor: not-allowed; }
/* 폐기 상태 */
.qb-st-void { background: #fee2e2; color: #dc2626; }

/* 폐기 행 스타일 */
.qb-row-void td {
  text-decoration: line-through;
  color: #ef4444 !important;
  opacity: 0.7;
}
.qb-row-void td strong,
.qb-row-void td span,
.qb-row-void td input { color: #ef4444 !important; }

/* 폐기 워터마크 */
.qb-void-watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 120px;
  font-weight: 900;
  color: rgba(220, 38, 38, 0.22);
  pointer-events: none;
  z-index: 9999;
  letter-spacing: 0.1em;
  user-select: none;
  white-space: nowrap;
}
@media print {
  .qb-void-watermark {
    position: fixed;
    color: rgba(220, 38, 38, 0.18);
  }
}

.qb-id-code {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  background: transparent;
  padding: 2px 0;
  border-radius: 0;
  color: #111827;
  font-weight: 600;
}

.qb-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.qb-st-draft    { background: #f1f5f9; color: #64748b; }
.qb-st-approved { background: #dcfce7; color: #166534; }
.qb-st-sent     { background: #dbeafe; color: #1d4ed8; }
.qb-st-viewed   { background: #fef9c3; color: #854d0e; }

.qb-approve-mini {
  margin-left: 4px;
  padding: 2px 5px;
  border: 1px solid #22c55e;
  border-radius: 4px;
  background: #f0fdf4;
  color: #16a34a;
  font-size: 10px;
  cursor: pointer;
  vertical-align: middle;
}
.qb-approve-mini:hover { background: #dcfce7; }

.qb-memo-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  min-width: 80px;
}
.qb-memo-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--primary-bg);
}

/* 작업 버튼 */
.qb-action-cell { white-space: nowrap; }
.qb-act-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  background: #fff;
  color: var(--gray-500);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  margin: 1px;
}
.qb-act-btn:hover { background: var(--gray-50); color: var(--gray-700); }
.qb-act-edit:hover  { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.qb-act-view:hover  { border-color: #7c3aed; color: #7c3aed; background: #f5f3ff; }
.qb-act-share:hover { border-color: #0891b2; color: #0891b2; background: #ecfeff; }
.qb-act-copy:hover  { border-color: #d97706; color: #d97706; background: #fffbeb; }
.qb-act-danger:hover{ border-color: #dc2626; color: #dc2626; background: #fef2f2; }

.qb-svc-mini {
  display: inline-block;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #dbeafe;
  color: #1d4ed8;
  margin: 1px 1px 2px;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* 서비스 컬럼 (목록 4열) */
.qb-svc-col {
  max-width: 160px;
  white-space: normal;
  line-height: 1.6;
}
.qb-svc-col .qb-svc-badge {
  margin: 1px 1px 2px;
  display: inline-block;
  vertical-align: middle;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* +숫자 뱃지 툴팁 */
.qb-badge-more {
  position: relative;
  cursor: pointer;
  font-weight: 700;
}
.qb-badge-more::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  font-size: 11px;
  font-weight: 400;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: pre;        /* \n 줄바꿈 허용 */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  line-height: 1.6;
}
.qb-badge-more::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  z-index: 9999;
}
.qb-badge-more:hover::after,
.qb-badge-more:hover::before { opacity: 1; }

/* ===== 에디터 레이아웃 ===== */
.qb-editor {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h, 60px) - 20px);
  min-height: 600px;
}
.qb-editor-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.qb-hd-left { display: flex; align-items: center; gap: 10px; }
.qb-hd-id { font-size: 13px; font-weight: 700; color: var(--gray-700); }
.qb-hd-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.qb-hd-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  background: #fff;
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.qb-hd-btn:hover { background: var(--gray-50); border-color: var(--gray-400); }
.qb-hd-btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.qb-hd-btn-primary:hover { background: var(--primary-dark, #1e40af); }
.qb-hd-btn-warn { background: #d97706; color: #fff; border-color: #d97706; }
.qb-hd-btn-warn:hover { background: #b45309; }

.qb-editor-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== 좌측 패널 ===== */
.qb-panel {
  width: 290px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--gray-50);
  border-right: 1px solid var(--gray-200);
  padding: 10px;
}
.qb-sec {
  background: #fff;
  border-radius: 8px;
  padding: 11px;
  margin-bottom: 8px;
  border: 1px solid var(--gray-200);
}
.qb-sec-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.qb-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 3px;
  display: block;
}
.qb-input {
  font-size: 12px !important;
  padding: 5px 8px !important;
}
.qb-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }

/* 유형 버튼 */
.qb-type-btn {
  flex: 1;
  padding: 7px 10px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  background: #fff;
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.qb-type-btn.active {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
}
.qb-type-btn:hover { border-color: var(--primary); }

/* 약정 힌트 */
.qb-contract-hint {
  margin-top: 8px;
  padding: 7px 9px;
  background: var(--primary-bg, #eff6ff);
  border-radius: 6px;
  font-size: 11px;
  color: var(--gray-600);
  line-height: 1.7;
}

/* 첨부 옵션 */
.qb-check-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  color: var(--gray-700);
}
.qb-check-hint {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: 4px;
  line-height: 1.4;
}

/* 비고 템플릿 버튼 */
.qb-tpl-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 11px;
  font-family: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.qb-tpl-btn:hover { background: #e2e8f0; border-color: #94a3b8; }
.qb-tpl-clear { border-color: #fca5a5; color: #dc2626; }
.qb-tpl-clear:hover { background: #fef2f2; border-color: #ef4444; }

/* 탭 */
.qb-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 7px;
}
.qb-tab {
  padding: 3px 9px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: #fff;
  color: var(--gray-500);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.12s;
}
.qb-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.qb-tab:hover:not(.active) { background: var(--gray-50); border-color: var(--gray-300); }

/* 상품 패널 */
.qb-prod-panel { display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow-y: auto; }
.qb-prod-row {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.1s;
}
.qb-prod-row:hover { background: var(--primary-bg); border-color: var(--primary-border, #bfdbfe); }
.qb-prod-info { flex: 1; min-width: 0; }
.qb-prod-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qb-prod-sub { font-size: 10px; color: var(--gray-400); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 1px; }
.qb-add-btn {
  width: 22px; height: 22px;
  border: 1px solid var(--primary);
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s;
}
.qb-add-btn:hover { background: var(--primary); color: #fff; }
.qb-add-disc { border-color: #dc2626; background: #fff5f5; color: #dc2626; }
.qb-add-disc:hover { background: #dc2626; color: #fff; }
.qb-fixed-badge {
  font-size: 9px;
  background: #fef3c7;
  color: #d97706;
  padding: 1px 5px;
  border-radius: 8px;
}

/* 서비스 뱃지 */
.qb-svc-badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 600;
}
.qb-svc-badge.qb-svc-상품        { background: #dbeafe; color: #1d4ed8; }
.qb-svc-badge.qb-svc-부가서비스   { background: #dcfce7; color: #166534; }
.qb-svc-badge.qb-svc-확장서비스   { background: #fef9c3; color: #854d0e; }
.qb-svc-badge.qb-svc-기타        { background: #f1f5f9; color: #475569; }

/* 할인 패널 */
.qb-disc-panel { display: flex; flex-direction: column; gap: 3px; }
.qb-disc-row {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.1s;
}
.qb-disc-row:hover { background: #fff5f5; border-color: #fecaca; }

.qb-no-result {
  text-align: center;
  padding: 12px;
  color: var(--gray-400);
  font-size: 12px;
}

/* ===== 우측: 항목 테이블 ===== */
.qb-items-wrap {
  flex: 1;
  overflow-y: auto;
  background: #f8fafc;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.qb-items-header {
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
/* 직접 입력 버튼 */
.qb-manual-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px dashed #7c3aed;
  border-radius: 6px;
  background: #faf5ff;
  color: #7c3aed;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.qb-manual-add-btn:hover { background: #f3e8ff; border-style: solid; }
.qb-empty-items {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 50px 20px;
  color: var(--gray-300);
  font-size: 14px;
}

.qb-items-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.qb-items-tbl th {
  background: var(--primary);
  color: #fff;
  padding: 6px 6px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.qb-items-tbl td { padding: 5px 5px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
/* 비고란: 최대 3줄로 제한, 넘치면 말줄임표 */
.qb-items-tbl td:nth-last-child(2) {
  text-align: left;
  font-size: 10px;
  line-height: 1.3;
  max-width: 80px;
  max-height: 40px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-all;
  white-space: normal;
}
/* qb-td-cat: 아래에 상세 정의됨 */
.qb-td-name { font-size: 12px; }
.qb-td-num { text-align: right; }
/* 할인행: 배경색 없음, 글자색만 빨간색 */
.qb-row-disc td { background: transparent; }
.qb-disc-name { color: #dc2626; }
.qb-disc-arrow { margin-right: 4px; font-size: 10px; color: #dc2626; }

/* 드래그 핸들 */
.qb-drag-handle {
  width: 20px;
  text-align: center;
  color: #94a3b8;
  cursor: grab;
  padding: 0 2px;
  font-size: 12px;
  user-select: none;
}
.qb-drag-handle:hover { color: #3b82f6; }
.qb-drag-handle:active { cursor: grabbing; }
.qb-dragging { opacity: 0.5; background: #eff6ff !important; }
.qb-dragging td { background: #eff6ff !important; }

.qb-cell-input {
  border: 1px solid transparent;
  background: transparent;
  font-size: 11px;
  text-align: right;
  font-family: inherit;
  padding: 2px 4px;
  border-radius: 3px;
  color: inherit;
}
.qb-cell-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--primary-bg);
}
.qb-name-input {
  text-align: left !important;
  min-width: 120px;
}
/* 분류열 - 줄바꿈 방지 */
.qb-td-cat {
  font-size: 10px;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

.qb-del-btn {
  width: 20px; height: 20px;
  border: none;
  background: transparent;
  color: var(--gray-300);
  font-size: 11px;
  cursor: pointer;
  border-radius: 3px;
}
.qb-del-btn:hover { background: #fee2e2; color: #dc2626; }

.qb-item-badges { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
.qb-badge-mini {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #075985;
}

/* 합계 영역 */
.qb-totals {
  padding: 12px 16px;
  background: #fff;
  border-top: 2px solid var(--gray-200);
  flex-shrink: 0;
}
.qb-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 12px;
}
.qb-total-final {
  padding-top: 8px;
  border-top: 2px solid var(--primary);
  margin-top: 6px;
  font-weight: 700;
}

/* ========================================
   미리보기 모달
   ======================================== */
#qb-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}
#qb-preview-modal.hidden { display: none !important; }

.qb-prev-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}
.qb-prev-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  display: flex;
  flex-direction: column;
  height: 100vh;          /* 전체 높이 고정 */
  min-height: 0;          /* flex 자식 shrink 허용 */
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  overflow: hidden;       /* 패널 자체는 clip */
}
.qb-prev-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #1e3a5f;
  color: #fff;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
}
.qb-prev-hd .qb-check-label { color: #fff; }
.qb-prev-body {
  flex: 1 1 0;            /* 남은 공간 채우되 shrink 허용 */
  min-height: 0;          /* flex 자식의 overflow-y 동작을 위해 필수 */
  overflow-y: auto;
  overflow-x: hidden;
  background: #e5e7eb;
  padding: 20px;
}
.qb-prev-footer {
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: center;
}
.qb-view-confirm-btn {
  padding: 8px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.qb-view-confirm-btn:hover { opacity: 0.9; }
.qb-prev-close {
  width: 30px; height: 30px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.qb-prev-close:hover { background: rgba(255,255,255,0.15); }

/* ========================================
   견적서 팜플렛 페이지 공통
   ======================================== */
.qp-page {
  background: #fff;
  max-width: 860px;
  margin: 0 auto 24px;
  padding: 36px 40px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 12px;
  color: #111;
}
.qp-logo-zio { color: #2563eb; font-weight: 900; letter-spacing: -0.5px; }
.qp-logo-you { color: #111; font-weight: 900; letter-spacing: -0.5px; }

/* ── P1: 표지 ── */
.qp-cover { min-height: 600px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.qp-cover-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}
.qp-logo-area { font-size: 26px; }
.qp-cover-code { font-size: 12px; color: var(--gray-500); }
.qp-cover-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.qp-cover-tag {
  font-size: 14px;
  color: #2563eb;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}
.qp-cover-title {
  font-size: 42px;
  font-weight: 900;
  color: #111;
  margin: 0 0 16px;
  letter-spacing: 4px;
}
.qp-cover-kindbox {
  display: inline-block;
  padding: 8px 24px;
  border: 2px solid #2563eb;
  border-radius: 6px;
  font-size: 14px;
  color: #1e3a5f;
  margin-bottom: 30px;
}
.qp-cover-terms-box {
  max-width: 540px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 20px 28px;
  text-align: left;
}
.qp-cover-terms-title { font-weight: 700; font-size: 13px; margin-bottom: 12px; color: #1e3a5f; }
.qp-cover-terms-list { padding-left: 20px; margin: 0 0 14px; line-height: 2.2; color: #374151; font-size: 12px; }
.qp-cover-terms-list li { margin-bottom: 2px; }
.qp-cover-closing { font-size: 12px; color: #6b7280; margin: 0; text-align: center; }
.qp-cover-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid #1e3a5f;
}
.qp-cover-date { font-size: 14px; color: #374151; }
.qp-cover-to { font-size: 20px; font-weight: 700; color: #111; }

/* ── P2/P3: 본문 ── */
.qp-body-page {}
.qp-body-header { margin-bottom: 14px; }
.qp-body-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.qp-body-title { font-size: 18px; font-weight: 800; color: #1e3a5f; margin: 0; }
.qp-logo-sm { font-size: 18px; }
.qp-info-grid { margin-bottom: 12px; }
.qp-info-tbl { width: 100%; border-collapse: collapse; font-size: 11px; }
.qp-info-tbl th {
  background: #f1f5f9;
  padding: 4px 8px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid #e2e8f0;
  width: 65px;
  color: #374151;
}
.qp-info-tbl td { padding: 4px 8px; border: 1px solid #e2e8f0; }
.qp-total-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e3a5f;
  color: #fff;
  padding: 10px 18px;
  border-radius: 4px;
  margin-bottom: 10px;
}
.qp-total-lbl { font-size: 13px; font-weight: 600; }
.qp-total-amt { font-size: 22px; font-weight: 900; letter-spacing: -0.5px; }
.qp-contract-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #92400e;
}
.qp-contract-box { display: flex; align-items: center; gap: 6px; }
.qp-contract-val { font-size: 16px; font-weight: 900; color: #d97706; padding: 1px 8px; background: #fef3c7; border-radius: 4px; }
.qp-contract-note { font-size: 11px; width: 100%; }
.qp-badges-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.qp-badge {
  font-size: 10px;
  padding: 2px 10px;
  border-radius: 12px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
  border: 1px solid #bfdbfe;
}
/* 품목 테이블 */
.qp-items-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-bottom: 12px;
}
.qp-items-tbl th {
  background: #1e3a5f;
  color: #fff;
  padding: 5px 5px;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid #2d4a6f;
}
.qp-items-tbl td { padding: 5px 5px; border: 1px solid #e2e8f0; vertical-align: middle; }
.qp-items-tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.qp-col-cat { width: 60px; font-size: 10px; text-align: center !important; }
.qp-col-name { min-width: 180px; }
.qp-items-tbl td.qp-col-name { text-align: left; }
.qp-items-tbl th.qp-col-name { text-align: center; }
.qp-item-row:hover { background: #f8fafc; }
/* 할인행: 배경색 없음, 글자색만 빨간색 */
.qp-disc-row { background: transparent; }
.qp-disc-row td { background: transparent; color: #dc2626; }
.qp-disc-arrow { font-size: 10px; margin-right: 3px; }
.qp-red { color: #dc2626 !important; }
.qp-yellow { background: #fffbeb !important; font-weight: 700; color: #92400e; }
.qp-subtotal-row td { background: #f8fafc; border-top: 1px solid #e2e8f0; }
.qp-final-row td { background: #fffbeb; border-top: 3px solid #d97706; font-weight: 700; }
.qp-final-amt { font-size: 14px !important; color: #1e3a5f !important; }
.qp-item-badge-wrap { display: inline-flex; gap: 3px; margin-left: 5px; vertical-align: middle; }
.qp-item-badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #075985;
}
.qp-memo {
  margin-top: 14px;
  padding: 10px 12px;
  background: #f8fafc;
  border-left: 3px solid var(--primary);
  font-size: 11px;
  color: #475569;
  line-height: 1.8;
}

/* ── P4: FAQ ── */
.qp-faq-page {}
.qp-page-header { margin-bottom: 20px; border-bottom: 2px solid #1e3a5f; padding-bottom: 12px; }
.qp-page-title { font-size: 20px; font-weight: 800; color: #1e3a5f; margin: 0 0 4px; }
.qp-page-subtitle { font-size: 12px; color: var(--gray-500); margin: 0; }
.qp-faq-list { display: flex; flex-direction: column; gap: 14px; }
.qp-faq-item { background: #f8fafc; border-radius: 8px; border: 1px solid #e2e8f0; overflow: hidden; }
.qp-faq-q {
  background: #1e3a5f;
  color: #fff;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.qp-faq-a {
  padding: 10px 14px;
  font-size: 11px;
  line-height: 1.9;
  color: #374151;
}

/* ── P5: 부가서비스 (테이블 형태) ── */
.qp-addon-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-bottom: 10px;
}
.qp-addon-tbl th {
  background: #1e3a5f;
  color: #fff;
  padding: 6px 8px;
  font-weight: 600;
  text-align: left;
  border: 1px solid #2d4a6f;
  white-space: nowrap;
}
.qp-addon-tbl td {
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
  vertical-align: middle;
}
.qp-addon-row:nth-child(even) td { background: #f8fafc; }
.qp-addon-row:hover td { background: #eff6ff; }
.qp-addon-cat-cell {
  background: #eef2ff !important;
  vertical-align: middle;
  text-align: center;
  padding: 6px 5px !important;
  border-right: 2px solid #1e3a5f !important;
  min-width: 80px;
}
.qp-addon-cat-badge {
  display: inline-block;
  writing-mode: horizontal-tb;
  font-size: 10px;
  font-weight: 700;
  color: #1e3a5f;
  background: #c7d2fe;
  padding: 3px 6px;
  border-radius: 10px;
  white-space: normal;
  word-break: keep-all;
  line-height: 1.4;
  text-align: center;
}
.qp-addon-item-name {
  font-weight: 600;
  color: #111;
  white-space: nowrap;
}
.qp-addon-price-cell {
  text-align: right;
  white-space: nowrap;
  font-weight: 600;
}
.qp-addon-price { color: var(--primary); }
.qp-addon-price-disc { color: #dc2626; }
.qp-addon-price-na { color: #6b7280; font-style: italic; font-weight: 400; }
.qp-addon-price-special { color: #7c3aed; font-weight: 700; }
.qp-addon-desc-cell { font-size: 10px; color: #6b7280; line-height: 1.5; }
.qp-addon-note {
  font-size: 10px;
  color: #6b7280;
  padding: 6px 8px;
  background: #f8fafc;
  border-radius: 4px;
  border-left: 3px solid var(--primary);
}

/* ── P6: 계좌·담당자 ── */
.qp-contact-body { display: flex; gap: 20px; flex-wrap: wrap; }
.qp-bank-card {
  flex: 1;
  min-width: 260px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  overflow: hidden;
}
.qp-bank-head {
  background: linear-gradient(135deg, #1e40af, #1d4ed8);
  color: #fff;
  padding: 14px 16px;
}
.qp-bank-logo-wrap { font-size: 13px; font-weight: 700; margin-bottom: 8px; opacity: 0.9; }
.qp-bank-logo-kb {
  display: inline-block;
  background: #f59e0b;
  color: #fff;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  margin-right: 4px;
}
.qp-bank-account-big { font-size: 20px; font-weight: 900; letter-spacing: 1px; }
.qp-bank-rows { padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.qp-bank-row { display: flex; align-items: center; font-size: 11px; }
.qp-bank-row span { min-width: 90px; color: #475569; }
.qp-bank-row strong { color: #111; }
.qp-bank-warn {
  margin: 0 12px 12px;
  padding: 8px 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 10px;
  color: #991b1b;
  line-height: 1.6;
}

.qp-contact-card {
  flex: 1;
  min-width: 240px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
}
.qp-contact-photo-wrap { flex-shrink: 0; }
.qp-contact-photo-img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }
.qp-contact-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qp-contact-info { flex: 1; min-width: 0; }
.qp-contact-name { font-size: 16px; font-weight: 800; color: #111; margin-bottom: 2px; }
.qp-contact-dept { font-size: 11px; color: var(--primary); font-weight: 600; margin-bottom: 6px; }
.qp-contact-company { font-size: 12px; font-weight: 700; color: #374151; margin-bottom: 8px; }
.qp-contact-row { font-size: 11px; color: #475569; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }

.qp-supplier-note {
  width: 100%;
  margin-top: 14px;
  background: #1e3a5f;
  border-radius: 8px;
  overflow: hidden;
}
.qp-supplier-title {
  background: #152f52;
  color: #93c5fd;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.qp-supplier-rows { padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.qp-supplier-row { display: flex; gap: 8px; font-size: 11px; min-width: 200px; }
.qp-supplier-row span:first-child { color: #93c5fd; min-width: 80px; }
.qp-supplier-row span:last-child { color: #e2e8f0; }

/* ── P7/P8(옵션): 통장사본·사업자등록증 원본 이미지 페이지 ── */
.qp-bank-doc-page { display: flex; flex-direction: column; }

/* 헤더: 제목 + 원본보기/저장 버튼 */
.qp-attach-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #1e3a5f;
  color: #fff;
  border-radius: 6px 6px 0 0;
  margin-bottom: 0;
}
.qp-attach-tag {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.qp-attach-btns {
  display: flex;
  gap: 8px;
}
.qp-doc-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 5px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.qp-doc-btn:hover { background: rgba(255,255,255,0.28); }

/* 이미지 영역: 원본 이미지 전체 표시 */
.qp-attach-img-wrap {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 6px 6px;
  min-height: 600px;
}
.qp-attach-full-img {
  max-width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border-radius: 4px;
}

/* 기존 호환 스타일 유지 (구버전 참조용) */
.qp-docs-grid { display: flex; gap: 20px; flex-wrap: wrap; }
.qp-doc-section { flex: 1; min-width: 280px; }
.qp-acct-no { font-size: 14px; color: #1d4ed8 !important; font-family: 'Courier New', monospace; }
.qp-bizno { font-size: 14px; color: #1d4ed8 !important; font-family: 'Courier New', monospace; }
.qp-biz-label {
  display: inline-block;
  background: #f1f5f9;
  color: #475569;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 4px;
}

/* ========================================
   인쇄 전용 오버레이 (qb-print-overlay)
   window.print() 대신 별도 오버레이로 인쇄
   ======================================== */
#qb-print-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #fff;
  overflow: auto;
  padding: 20px 0;
}
#qb-print-overlay.active { display: block; }
#qb-print-overlay .qp-page {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin: 0 auto 20px;
  max-width: 860px;
}

@media print {
  @page { size: A4 portrait; margin: 10mm 12mm; }
  /* 인쇄 시 오버레이만 표시 */
  body.qb-printing * { visibility: hidden; }
  body.qb-printing #qb-print-overlay,
  body.qb-printing #qb-print-overlay * { visibility: visible; }
  body.qb-printing #qb-print-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    z-index: 99999 !important;
    background: #fff !important;
    padding: 0 !important;
  }
  /* qb-printing 미적용 시 (일반 미리보기에서 인쇄) — qb-viewer(quote-viewer.html)는 제외 */
  body:not(.qb-printing):not(.qb-viewer) > *:not(#qb-preview-modal) { display: none !important; }
  body:not(.qb-printing):not(.qb-viewer) #qb-preview-modal {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
  }
  body:not(.qb-printing):not(.qb-viewer) .qb-prev-overlay,
  body:not(.qb-printing):not(.qb-viewer) .qb-prev-hd,
  body:not(.qb-printing):not(.qb-viewer) .qb-prev-footer,
  body:not(.qb-printing):not(.qb-viewer) .no-print { display: none !important; }
  body:not(.qb-printing):not(.qb-viewer) .qb-prev-panel {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  body:not(.qb-printing):not(.qb-viewer) #quote-printable {
    display: block !important;
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }
  #qb-print-overlay .qp-page,
  body:not(.qb-printing) .qp-page {
    box-shadow: none !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 12px 18px !important;
    page-break-after: always;
    break-after: page;
    display: block !important;
  }
  .print-page { page-break-after: always; break-after: page; }
  .print-page:last-child { page-break-after: avoid; break-after: avoid; }
  .qp-items-tbl tr  { page-break-inside: avoid; break-inside: avoid; }
  .qp-faq-item      { page-break-inside: avoid; break-inside: avoid; }
  .qp-addon-tbl tr  { page-break-inside: avoid; break-inside: avoid; }
  .no-print         { display: none !important; }
  /* 비고란: 인쇄/PDF 시 텍스트 전부 표시 */
  .qp-items-tbl td.note-cell,
  .qp-items-tbl td[class*="note"] {
    max-height: none !important;
    overflow: visible !important;
    -webkit-line-clamp: unset !important;
    display: block !important;
    white-space: pre-wrap !important;
    word-break: break-all;
  }
}

/* ========================================
   반응형
   ======================================== */
@media (max-width: 900px) {
  .qb-editor-body { flex-direction: column; overflow-y: auto; }
  .qb-panel { width: 100%; border-right: none; border-bottom: 1px solid var(--gray-200); max-height: 50vh; }
  .qb-items-wrap { min-height: 400px; }
  .qp-docs-grid { flex-direction: column; }
  .qp-contact-body { flex-direction: column; }
}

/* ========================================
   닥스클라우드 견적서 전용 스타일
   ======================================== */
.dox-tbl td, .dox-tbl th {
  border: 1px solid #cbd5e1;
  padding: 4px 5px;
  vertical-align: middle;
}
.dox-hth {
  padding: 6px 5px;
  text-align: center;
  font-size: 11px;
}
.dox-th {
  background: #e8edf5;
  font-weight: 700;
  text-align: center;
  border: 1px solid #94a3b8;
  padding: 5px 6px;
  vertical-align: middle;
}
.dox-td {
  border: 1px solid #94a3b8;
  padding: 4px 8px;
}
.dox-cat {
  background: #e8edf5;
  font-weight: 700;
  text-align: center;
  border: 1px solid #94a3b8;
  vertical-align: middle;
  font-size: 11px;
  color: #1e3a5f;
}
.dox-item-name { text-align: left; padding-left: 8px; }
.dox-num { text-align: right; padding-right: 6px; }
.dox-remark { text-align: center; font-size: 10px; color: #64748b; }
.dox-subtotal-row td {
  background: #e8edf5;
  border-top: 1.5px solid #94a3b8;
  border-bottom: 1.5px solid #94a3b8;
}
.dox-note-row td {
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px dashed #e2e8f0;
  background: #fafafa;
}
