/* ===================================================
   신신엠앤씨 견적서 — 통합 스타일시트 v5
   =================================================== */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans KR', sans-serif;
  background: #eef1f7;
  color: #1a1a2e;
  min-height: 100vh;
}
input, select, textarea, button { font-family: inherit; }

/* ── CSS 변수 ── */
:root {
  --primary:        #1a3a6b;
  --primary-light:  #2557a7;
  --primary-pale:   #edf2fb;
  --accent:         #e63946;
  --gold:           #ffd166;
  --success:        #2a9d8f;
  --bg-panel:       #ffffff;
  --bg-toolbar:     #1a3a6b;
  --border:         #dce1ea;
  --border-light:   #f0f3f8;
  --text-body:      #1a1a2e;
  --text-muted:     #6b7280;
  --text-sub:       #9ca3af;
  --shadow-sm:      0 1px 4px rgba(0,0,0,.08);
  --shadow-md:      0 4px 20px rgba(0,0,0,.11);
  --radius:         10px;
  --radius-sm:      6px;
}

/* ═══════════════════════════════════════════════
   TOOLBAR
═══════════════════════════════════════════════ */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 58px;
  background: var(--bg-toolbar);
  box-shadow: 0 2px 12px rgba(0,0,0,.28);
}
.toolbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
}
.toolbar-brand i { color: var(--gold); font-size: 1.25rem; }
.toolbar-actions { display: flex; gap: 10px; align-items: center; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  transition: all .18s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary         { background: var(--gold); color: #1a1a2e; }
.btn-primary:hover   { background: #ffbe33; }
.btn-secondary       { background: #4a90d9; color: #fff; }
.btn-secondary:hover { background: #3478c0; }
.btn-outline         { background: transparent; border: 1.5px solid rgba(255,255,255,.5); color: #fff; }
.btn-outline:hover   { background: rgba(255,255,255,.12); }
.btn-outline-dark    { background: #fff; border: 1.5px solid #d1d5db; color: #374151; }
.btn-outline-dark:hover { background: #f3f4f6; }
.btn-admin           { background: rgba(255,255,255,.12); border: 1.5px solid rgba(255,255,255,.3); color: rgba(255,255,255,.9); }
.btn-admin:hover     { background: rgba(255,255,255,.22); color: #fff; }
.btn-danger          { background: #fee2e2; color: var(--accent); border: 1px solid #fca5a5; }
.btn-danger:hover    { background: #fca5a5; color: #fff; }
.btn-success         { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.btn-success:hover   { background: #6ee7b7; }
.btn-sm              { padding: 5px 12px; font-size: .8rem; }

/* ═══════════════════════════════════════════════
   PAGE LAYOUT  (left panel + right document)
═══════════════════════════════════════════════ */
.page-layout {
  display: grid;
  grid-template-columns: 318px 1fr;
  gap: 20px;
  padding: 20px;
  max-width: 1440px;
  margin: 0 auto;
  align-items: start;
}

/* ── Left Panel ── */
.panel-left {
  background: var(--bg-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 92px);
  display: flex;
  flex-direction: column;
}
.panel-header {
  background: var(--primary);
  color: #fff;
  padding: 14px 18px;
  font-weight: 700;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  letter-spacing: .01em;
}
.filter-section { padding: 13px 14px 0; flex-shrink: 0; }
.filter-label {
  display: block;
  font-size: .7rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.category-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
  background: var(--primary-pale);
  color: var(--primary);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.chip:hover  { border-color: var(--primary-light); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.search-wrap { position: relative; margin: 10px 14px 6px; flex-shrink: 0; }
.search-wrap i {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-sub); font-size: .85rem;
}
.search-wrap input {
  width: 100%;
  padding: 8px 10px 8px 32px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .84rem;
  outline: none;
  transition: border-color .15s;
}
.search-wrap input:focus { border-color: var(--primary-light); }

.product-list { overflow-y: auto; flex: 1; padding: 6px 8px 10px; }
.product-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  margin-bottom: 6px;
  background: #fafbfd;
  transition: all .15s;
  cursor: pointer;
}
.product-card:hover {
  border-color: var(--primary-light);
  background: var(--primary-pale);
  box-shadow: var(--shadow-sm);
}
.product-card-info { flex: 1; min-width: 0; }
.product-card-name {
  font-size: .87rem; font-weight: 700; color: #1a1a2e;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.product-card-model { font-size: .74rem; color: var(--text-muted); margin-top: 2px; }
.product-card-spec  {
  font-size: .72rem; color: #8492a6; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.product-card-price {
  font-size: .82rem; font-weight: 700; color: var(--primary);
  white-space: nowrap; margin-left: 8px; text-align: right;
}
.product-card-price small { display: block; font-size: .68rem; font-weight: 400; color: var(--text-sub); }

/* 카테고리 배지 */
.cat-badge {
  display: inline-block;
  font-size: .67rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e0e7ff;
  color: #3730a3;
  font-weight: 700;
  margin-bottom: 3px;
}
[data-cat="카드단말기"]      { background: #dbeafe !important; color: #1e40af !important; }
[data-cat="POS 시스템"]      { background: #d1fae5 !important; color: #065f46 !important; }
[data-cat="키오스크"]        { background: #fef9c3 !important; color: #854d0e !important; }
[data-cat="프린터/주변기기"] { background: #f3e8ff !important; color: #581c87 !important; }
[data-cat="소모품"]          { background: #ffe4e6 !important; color: #9f1239 !important; }
[data-cat="서비스"]          { background: #f1f5f9 !important; color: #475569 !important; }

/* 직접 추가 버튼 */
.add-custom-btn {
  width: calc(100% - 16px);
  margin: 4px 8px 12px;
  padding: 9px 0;
  background: transparent;
  border: 1.5px dashed var(--primary-light);
  border-radius: var(--radius-sm);
  color: var(--primary-light);
  font-size: .84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
}
.add-custom-btn:hover { background: var(--primary-pale); }

/* ── Right Panel ── */
.panel-right { min-width: 0; }
.quote-document {
  background: var(--bg-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 34px 38px 30px;
}

/* ════════════════════════════════════════
   견적서 헤더
════════════════════════════════════════ */
.quote-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 0;
}
.quote-header-left {}
.quote-title-badge {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: .4em;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 10px;
}
.quote-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.quote-meta span {
  font-size: .81rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.quote-meta strong { color: #374151; }

.quote-header-right { text-align: right; }
.company-name-big {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: .03em;
  line-height: 1.1;
}
.company-sub {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: .02em;
}
.company-contact-line {
  font-size: .76rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 헤더 구분선 */
.divider-double {
  margin: 14px 0 20px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 60%, var(--primary-light) 100%);
  border-radius: 2px;
}

/* ════════════════════════════════════════
   수신처 / 발신처 — 2분할 카드 섹션
════════════════════════════════════════ */
.party-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

/* 카드 공통 */
.party-card {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: #fff;
}
.party-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1.5px solid var(--border);
}
.party-card-title {
  font-size: .88rem;
  font-weight: 700;
  color: #374151;
}

/* 수신 태그 */
.party-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 22px;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .05em;
}
.tag-receiver {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.tag-sender {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

/* 수신 카드 헤더 배경 */
.party-receiver .party-card-header { background: #f8faff; }
.party-sender  .party-card-header  { background: #fffbf7; }

/* 필드 영역 */
.party-fields {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.party-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.party-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.party-field label {
  font-size: .74rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .02em;
}
.party-input {
  width: 100%;
  padding: 6px 10px;
  border: 1.5px solid var(--border-light);
  border-radius: 5px;
  font-size: .86rem;
  color: #111827;
  outline: none;
  background: #fafbfd;
  transition: border-color .15s, background .15s;
}
.party-input:focus {
  border-color: var(--primary-light);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,87,167,.08);
}
.party-input::placeholder { color: #c8d0da; }

/* ════════════════════════════════════════
   금액 배너
════════════════════════════════════════ */
.amount-banner {
  background: linear-gradient(135deg, #1a3a6b 0%, #2c5faa 100%);
  border-radius: var(--radius-sm);
  padding: 15px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  color: #fff;
}
.amount-banner-info { display: flex; align-items: center; gap: 8px; }
.amount-banner-info i { font-size: 1.1rem; opacity: .7; }
.amount-banner-label { font-size: .9rem; font-weight: 500; opacity: .85; }
.amount-banner-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--gold);
}

/* ════════════════════════════════════════
   섹션 제목
════════════════════════════════════════ */
.section-title {
  font-size: .97rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.item-count-badge {
  font-size: .72rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 2px;
}

/* ════════════════════════════════════════
   품목 테이블
════════════════════════════════════════ */
.items-section { margin-bottom: 22px; }
.table-scroll-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
.items-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
  font-size: .82rem;
}
.items-table thead th {
  background: var(--primary);
  color: #fff;
  padding: 10px 10px;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
  border: none;
}
.items-table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.items-table thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
.items-table tbody tr:nth-child(even) td { background: #f9fafb; }
.items-table tbody tr:hover td { background: #eef2ff !important; }
.items-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  text-align: center;
}
.items-table tbody td.td-name { text-align: left; font-weight: 500; }
.items-table tbody td.td-spec { text-align: left; font-size: .74rem; color: #6b7280; }

/* 인라인 편집 */
.qty-input, .price-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 4px;
  text-align: right;
  padding: 4px 6px;
  font-size: .82rem;
  font-family: inherit;
  outline: none;
  background: transparent;
  transition: all .15s;
}
.qty-input:focus, .price-input:focus {
  border-color: var(--primary-light);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(37,87,167,.12);
}
.qty-input::-webkit-inner-spin-button,
.price-input::-webkit-inner-spin-button { opacity: 1; }

.row-total { font-weight: 700; color: var(--primary-light); }
.empty-row {
  text-align: center !important;
  padding: 38px 0 !important;
  color: var(--text-muted);
  font-style: italic;
  background: #fafbfc !important;
}
.empty-row i { margin-right: 8px; opacity: .4; }

.del-btn {
  background: none; border: none; cursor: pointer;
  color: #ef4444; font-size: 1rem;
  padding: 4px 6px; border-radius: 4px; transition: background .15s;
}
.del-btn:hover { background: #fee2e2; }

/* tfoot */
.foot-row td { border-top: 1px solid var(--border); padding: 8px 12px; }
.foot-empty { background: transparent !important; }
.foot-label { text-align: right; font-weight: 500; color: #374151; }
.foot-value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .9rem; }
.total-row .foot-label { font-size: .95rem; font-weight: 800; color: var(--primary); background: #f0f4fa; }
.total-row .total-value { font-size: 1rem; font-weight: 800; color: var(--primary); background: #f0f4fa; }

/* ════════════════════════════════════════
   제품 이미지 첨부
════════════════════════════════════════ */
.product-images-section { margin-bottom: 22px; }

.img-upload-area {
  border: 2px dashed var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--primary-pale);
  transition: all .18s;
  color: var(--primary-light);
}
.img-upload-area:hover,
.img-upload-area.drag-over {
  background: #dbeafe;
  border-color: var(--primary);
}
.img-upload-area i { font-size: 2rem; margin-bottom: 8px; display: block; opacity: .6; }
.img-upload-area p  { font-size: .88rem; font-weight: 700; margin-bottom: 4px; }
.img-upload-area span { font-size: .75rem; color: var(--text-muted); }

.img-count-badge {
  font-size: .72rem; font-weight: 700;
  background: var(--primary); color: #fff;
  padding: 2px 8px; border-radius: 999px; margin-left: 2px;
}

.img-preview-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}
.img-preview-item {
  position: relative;
  width: 140px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: #f8fafc;
  aspect-ratio: 1 / 1;
}
.img-preview-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.img-preview-item .img-del-btn {
  position: absolute;
  top: 5px; right: 5px;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px; height: 24px;
  font-size: .75rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.img-preview-item .img-del-btn:hover { background: #ef4444; }
.img-preview-item .img-name {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: .65rem;
  padding: 3px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 인쇄용 이미지 그리드 */
.img-print-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.img-print-grid img {
  width: 100%; aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

@media print {
  .product-images-section.print-only { display: block !important; }
  .img-print-grid { gap: 5px; }
}

/* ════════════════════════════════════════
   특기사항
════════════════════════════════════════ */
.remarks-section { margin-bottom: 24px; }
.remarks-textarea {
  width: 100%; resize: vertical;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: .85rem; color: #374151;
  outline: none; transition: border-color .15s; line-height: 1.7;
}
.remarks-textarea:focus { border-color: var(--primary-light); }
.remarks-textarea::placeholder { color: #c8d0da; }

/* ════════════════════════════════════════
   서명란
════════════════════════════════════════ */
.quote-footer { border-top: 2px solid var(--primary); padding-top: 18px; }
.footer-text {
  font-size: .83rem; color: var(--text-muted);
  margin-bottom: 22px; text-align: center; line-height: 1.7;
}
.sig-blocks { display: flex; justify-content: flex-end; gap: 22px; }
.sig-block  { text-align: center; width: 108px; }
.sig-label  { font-size: .8rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.sig-box {
  border: 1.5px solid #374151;
  height: 56px;
  border-radius: 4px;
  margin-bottom: 5px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
}
.sig-box span { font-size: .8rem; color: var(--text-muted); }

/* ════════════════════════════════════════
   MODAL
════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.48);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: #fff;
  border-radius: var(--radius);
  width: 450px; max-width: 94vw;
  box-shadow: 0 14px 48px rgba(0,0,0,.22);
  overflow: hidden;
  animation: slideUp .2s ease;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px 20px;
  background: var(--primary); color: #fff;
  font-weight: 700; font-size: .95rem;
}
.modal-close {
  background: none; border: none; color: rgba(255,255,255,.7);
  font-size: 1.1rem; cursor: pointer; padding: 4px; transition: color .15s;
}
.modal-close:hover { color: #fff; }
.modal-body  { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.form-row    { display: flex; flex-direction: column; gap: 5px; }
.form-row.two-col            { flex-direction: row; gap: 16px; }
.form-row.two-col > div      { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.form-row label              { font-size: .8rem; font-weight: 700; color: #374151; }
.form-row input,
.form-row select {
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .88rem; outline: none; transition: border-color .15s;
}
.form-row input:focus,
.form-row select:focus { border-color: var(--primary-light); }
.required { color: var(--accent); }
.modal-footer {
  padding: 13px 20px;
  display: flex; justify-content: flex-end; gap: 10px;
  border-top: 1px solid var(--border); background: #f8fafc;
}

/* ════════════════════════════════════════
   TOAST 알림
════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 28px; right: 28px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600;
  color: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
  z-index: 9999;
  animation: toastIn .25s ease;
  pointer-events: none;
}
.toast-success { background: #059669; }
.toast-error   { background: #dc2626; }
@keyframes toastIn {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ════════════════════════════════════════
   PULSE 애니메이션
════════════════════════════════════════ */
@keyframes pulse {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.06); }
  70%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}
.pulse { animation: pulse .45s ease; }

/* ════════════════════════════════════════
   직인 (회사명 옆)
════════════════════════════════════════ */
.company-stamp-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.company-stamp {
  position: absolute;
  right: -18px;
  top: 50%;
  transform: translateY(-50%);
  width: 72px;
  height: 72px;
  object-fit: contain;
  opacity: 1;
  pointer-events: none;
  mix-blend-mode: normal;
  z-index: 2;
}
/* 인쇄 시 직인 색상 보존 */
@media print {
  .company-stamp {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    mix-blend-mode: normal;
  }
}

/* ════════════════════════════════════════
   판매유형 탭 & 배지
════════════════════════════════════════ */
.type-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 8px;
}
.type-tab {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.type-tab.active        { background: var(--primary); color: #fff; border-color: var(--primary); }
.type-tab.sale-tab.active   { background: #1a3a6b; border-color: #1a3a6b; }
.type-tab.rental-tab.active { background: #d97706; border-color: #d97706; }

.chip-wrap { display: flex; flex-wrap: wrap; gap: 5px; }

/* 판매/임대 배지 */
.type-badge {
  display: inline-block;
  font-size: .62rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  letter-spacing: .02em;
  vertical-align: middle;
}
.type-sale   { background: #dbeafe; color: #1e40af; }
.type-rental { background: #fef3c7; color: #92400e; }

.card-badges { display: flex; gap: 4px; align-items: center; margin-bottom: 3px; flex-wrap: wrap; }

/* 임대 품목 카드 강조 */
.product-card-rental {
  border-color: #fbbf24 !important;
  background: #fffbeb !important;
}
.product-card-rental:hover { background: #fef3c7 !important; }

/* 테이블 임대 행 */
.row-rental td { background: #fffdf0 !important; }
.row-rental:hover td { background: #fef9c3 !important; }

/* 임대 단가/월 입력 */
.rental-unit-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 4px;
  text-align: right;
  padding: 4px 6px;
  font-size: .82rem;
  font-family: inherit;
  outline: none;
  background: transparent;
  transition: all .15s;
  color: #92400e;
  font-weight: 700;
}
.rental-unit-input:focus {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 0 0 2px rgba(245,158,11,.15);
}

/* 임대 월비용 합산 표시 */
.rental-amt-value {
  font-weight: 700;
  color: #92400e;
}

/* 임대 금액 입력 */
.rental-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 4px;
  text-align: right;
  padding: 4px 6px;
  font-size: .82rem;
  font-family: inherit;
  outline: none;
  background: transparent;
  transition: all .15s;
  color: #92400e;
  font-weight: 700;
}
.rental-input:focus {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 0 0 2px rgba(245,158,11,.15);
}
.td-price-free { color: var(--text-sub); font-size: .78rem; }

/* 임대 합계 행 — 판매 합계 행과 동일한 크기 */
.rental-total-row .foot-label { font-size: .95rem; font-weight: 800; color: #92400e; background: #fffbeb; }
.rental-value { font-size: 1rem; font-weight: 800; color: #92400e; background: #fffbeb; }

/* 배너에 임대 월합계 병행 표시 */
.banner-rental-sum {
  font-size: 1.85rem;
  font-weight: 800;
  color: #fbbf24;
  margin-left: 14px;
  opacity: .9;
}
.banner-rental-sum small { font-size: 1rem; margin-left: 2px; }

/* 모달 유형 선택 */
.type-toggle-select {
  width: 100%;
  padding: 9px 12px;
  border: 2px solid var(--primary-light);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-pale);
  outline: none;
  cursor: pointer;
}

/* ════════════════════════════════════════
   PRINT  —  A4 1장 최적화
════════════════════════════════════════ */
.print-only { display: none; }

@media print {
  /* ── 기본 페이지 설정 ── */
  @page {
    size: A4 portrait;
    margin: 10mm 12mm;
  }

  /* ── 숨김 / 보임 ── */
  .no-print  { display: none !important; }
  .print-only{ display: block !important; }

  /* ── 레이아웃 단순화 ── */
  html, body { background: #fff !important; font-size: 11px !important; }
  .page-layout { display: block !important; padding: 0 !important; margin: 0 !important; }
  .panel-left  { display: none !important; }
  .panel-right { width: 100% !important; }

  /* ── 견적서 문서 영역 ── */
  .quote-document {
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 6mm 8mm !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* ── 헤더 ── */
  .quote-title-badge { font-size: 1.6rem !important; margin-bottom: 6px !important; }
  .company-name-big  { font-size: 1.2rem !important; }
  .divider-double    { margin: 8px 0 12px !important; }

  /* ── 수신/발신 카드 ── */
  .party-section {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }
  .party-card-header { padding: 6px 12px !important; }
  .party-fields      { padding: 8px 12px !important; gap: 5px !important; }
  .party-field-row   { grid-template-columns: 1fr 1fr !important; gap: 6px !important; }
  .party-input {
    border: none !important;
    background: transparent !important;
    padding: 1px 0 !important;
    font-size: .82rem !important;
  }

  /* ── 금액 배너 ── */
  .amount-banner {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    padding: 8px 16px !important;
    margin-bottom: 10px !important;
  }
  .amount-banner-value { font-size: 1.3rem !important; }

  /* ── 섹션 타이틀 ── */
  .section-title { font-size: .82rem !important; margin-bottom: 6px !important; }

  /* ── 품목 테이블 ── */
  .items-section    { margin-bottom: 10px !important; }
  .table-scroll-wrap{ overflow: visible !important; }
  .items-table {
    font-size: .72rem !important;
    min-width: unset !important;
    width: 100% !important;
    border-collapse: collapse !important;
  }
  .items-table thead th {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    padding: 5px 6px !important;
    font-size: .7rem !important;
  }
  .items-table tbody td {
    padding: 4px 6px !important;
    font-size: .72rem !important;
  }
  .items-table tfoot td { padding: 4px 6px !important; }
  .foot-empty { padding: 0 !important; border: none !important; }
  .foot-value  { font-size: .78rem !important; }
  .total-value { font-size: .82rem !important; }
  .total-row .foot-label,
  .total-row .total-value {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* 수량/단가 인풋 */
  .qty-input, .price-input {
    border: none !important;
    background: transparent !important;
    text-align: right !important;
    padding: 0 !important;
    font-size: .72rem !important;
  }

  /* 카테고리 배지 */
  .cat-badge {
    font-size: .6rem !important;
    padding: 1px 4px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  [data-cat] {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* 삭제 버튼 숨김 */
  .del-btn { display: none !important; }

  /* ── 특기사항 ── */
  .remarks-section   { margin-bottom: 10px !important; }
  .remarks-textarea {
    border: 1px solid #bbb !important;
    font-size: .75rem !important;
    padding: 6px 8px !important;
    min-height: 40px !important;
    resize: none !important;
  }

  /* ── 서명란 ── */
  .quote-footer  { padding-top: 10px !important; }
  .footer-text   { font-size: .72rem !important; margin-bottom: 12px !important; }
  .sig-blocks    { gap: 14px !important; }
  .sig-block     { width: 80px !important; }
  .sig-box       { height: 38px !important; }

  /* ── 직인 ── */
  .company-stamp {
    width: 60px !important;
    height: 60px !important;
    right: -14px !important;
    opacity: .9 !important;
  }

  /* ── 판매유형 배지 ── */
  .type-badge {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    font-size: .58rem !important;
  }
  .row-rental td {
    background: #fffdf0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .rental-value, .rental-total-row .foot-label {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .rental-input,
  .rental-unit-input {
    border: none !important;
    background: transparent !important;
    font-size: .72rem !important;
    padding: 0 !important;
  }
  .banner-rental-sum { font-size: 1.3rem !important; }
  .banner-rental-sum small { font-size: .8rem !important; }

  /* ── 페이지 나누기 방지 ── */
  .party-section, .amount-banner,
  .items-section, .remarks-section,
  .quote-footer { page-break-inside: avoid; }
}

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 960px) {
  .page-layout { grid-template-columns: 1fr; }
  .panel-left  { position: static; max-height: 420px; }
  .party-section { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .toolbar      { padding: 0 14px; }
  .quote-document { padding: 18px 14px; }
  .amount-banner-value { font-size: 1.4rem; }
  .party-field-row { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════
   관리자 페이지 공통 스타일
════════════════════════════════════════ */
.admin-wrap {
  max-width: 980px;
  margin: 32px auto;
  padding: 0 20px 40px;
}
.admin-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 24px;
}
.admin-card-header {
  background: var(--primary);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-card-header h2 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.admin-card-body  { padding: 24px; }

/* 관리자 품목 테이블 */
.admin-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.admin-table thead th {
  background: #f0f4fa;
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.admin-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.admin-table tbody tr:hover td { background: var(--primary-pale); }
.admin-table .td-actions { display: flex; gap: 6px; white-space: nowrap; }

/* 로그인 카드 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef1f7;
}
.login-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px 40px 36px;
  width: 380px;
  max-width: 94vw;
}
.login-card-logo { text-align: center; margin-bottom: 28px; }
.login-card-logo .logo-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: .02em;
}
.login-card-logo .logo-sub {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { font-size: .82rem; font-weight: 700; color: #374151; display: block; margin-bottom: 4px; }
.login-form input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  outline: none;
  transition: border-color .15s;
}
.login-form input:focus { border-color: var(--primary-light); }
.login-btn {
  width: 100%;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s;
  margin-top: 6px;
}
.login-btn:hover { background: var(--primary-light); }
.login-error {
  font-size: .82rem;
  color: var(--accent);
  text-align: center;
  display: none;
}
.login-error.show { display: block; }

/* 관리자 폼 그리드 */
.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}
.admin-form-grid .full-col { grid-column: 1 / -1; }
.admin-form-item { display: flex; flex-direction: column; gap: 5px; }
.admin-form-item label { font-size: .8rem; font-weight: 700; color: #374151; }
.admin-form-item input,
.admin-form-item select,
.admin-form-item textarea {
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  outline: none;
  transition: border-color .15s;
}
.admin-form-item input:focus,
.admin-form-item select:focus,
.admin-form-item textarea:focus { border-color: var(--primary-light); }

/* 탭 */
.admin-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.admin-tab {
  padding: 10px 20px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.admin-tab:hover { color: var(--primary); }
.admin-tab-panel { display: none; }
.admin-tab-panel.active { display: block; }

/* 배지 */
.badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-gray { background: #f1f5f9; color: #475569; }
