/* =============================================
   탁상감정 관리 시스템 - 스타일시트
   ============================================= */

/* ---- 기본 변수 ---- */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #64748b;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warning: #d97706;
  --info: #0891b2;
  --info-light: #ecfeff;

  --land-color: #16a34a;
  --land-light: #dcfce7;
  --building-color: #2563eb;
  --building-light: #dbeafe;
  --unit-color: #7c3aed;
  --unit-light: #ede9fe;

  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 280px;
  --header-h: 60px;
}

/* ---- 리셋 & 기본 ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Noto Sans KR', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

/* ---- 앱 레이아웃 ---- */
#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ---- 헤더 ---- */
#app-header {
  height: var(--header-h);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: var(--shadow);
  z-index: 100;
  flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.app-title { font-size: 1.2rem; font-weight: 700; letter-spacing: -.3px; }
.app-title i { margin-right: 6px; opacity: .85; }
.header-right { display: flex; gap: 8px; }

/* ---- 메인 래퍼 ---- */
#main-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ---- 목록으로 버튼 (옵션B 헤더) ---- */
.btn-back-list {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s, border-color .2s;
  white-space: nowrap;
}
.btn-back-list:hover {
  background: rgba(255,255,255,.28);
  border-color: rgba(255,255,255,.55);
  color: #fff;
}
.btn-back-list i { font-size: .78rem; }

/* ---- 헤더 보조 버튼 (아웃라인) ---- */
.btn-outline-primary {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.5);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}
.btn-outline-primary:hover { background: rgba(255,255,255,.2); }

/* ---- 메인 콘텐츠 ---- */
#main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
}

/* ---- 에디터 영역 (full-width, 옥션B) ---- */
.appraisal-editor { display: flex; flex-direction: column; height: 100%; }

.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}
.editor-title-area { display: flex; align-items: center; gap: 10px; }
.editor-title { font-size: 1.05rem; font-weight: 700; }
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 탭 네비 */
.tab-nav {
  display: flex;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  padding: 0 16px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }
.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all .2s;
}
.tab-btn:hover { color: var(--primary); background: var(--primary-light); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.tab-btn i { font-size: .8rem; }

/* 탭 콘텐츠 */
#tab-contents { flex: 1; overflow-y: auto; padding: 20px 24px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- 섹션 카드 ---- */
.section-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.section-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title i { color: var(--primary); }
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title-row .section-title { margin-bottom: 0; }

/* ---- 폼 ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: none;
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  background: var(--surface);
  color: var(--text-primary);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-group input[readonly] { background: var(--surface2); color: var(--text-secondary); }

/* 금액 입력창 우측 정렬 */
#q-fee, #q-vat, #q-total, #q-fee-expense { text-align: right; }
.form-group textarea { resize: vertical; }
.form-group.align-end { justify-content: flex-end; }

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.form-row .form-group { min-width: 120px; }
.form-row .flex-2 { flex: 2; min-width: 200px; }
.hint-text { font-size: .78rem; color: var(--text-muted); }

/* ---- 주소 입력 ---- */
.address-input-area { display: flex; flex-direction: column; gap: 12px; }
.input-with-btn { display: flex; gap: 8px; position: relative; }
.input-with-btn input { flex: 1; }
.copy-address-row { display: flex; align-items: center; gap: 10px; }

.address-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-weight: 600;
  color: var(--primary);
}
.address-display i { color: var(--primary); }

/* 자동완성 드롭다운 */
.dropdown-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  max-height: 240px;
  overflow-y: auto;
}
.dropdown-results .dong-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: .875rem;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.dropdown-results .dong-item:hover { background: var(--primary-light); }
.dropdown-results .dong-item:last-child { border-bottom: none; }
.dropdown-results .no-result {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
}
.dong-item mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
  font-style: normal;
}
.dong-item-name {
  font-weight: 600;
  margin-right: 6px;
}
.dong-item-full {
  font-size: .78rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 2px;
}
.form-group { position: relative; }

/* ---- 테이블 ---- */
.table-responsive { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.data-table th {
  background: var(--surface2);
  padding: 10px 10px;
  text-align: left;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: .83rem;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface2); }
.data-table .table-total-row td { background: var(--primary-light); font-weight: 700; }
.data-table .total-value { color: var(--primary); font-size: 1rem; text-align: right; white-space: nowrap; }
.data-table td input, .data-table td select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .82rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
.data-table td input:focus, .data-table td select:focus { border-color: var(--primary); }
.data-table td input[readonly] { background: var(--surface2); color: var(--text-secondary); text-align: right; }
.table-hint {
  margin-top: 10px;
  font-size: .8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.table-hint i { color: var(--info); }

/* ---- 결과 카드 ---- */
.result-card { background: linear-gradient(135deg, var(--primary-light), #e0f2fe); }
.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.result-label { font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: 8px; color: var(--primary); }
.result-label i { font-size: .9rem; }
.result-formula { font-size: .9rem; color: var(--text-secondary); }
.result-value { font-size: 1.4rem; font-weight: 800; color: var(--primary); white-space: nowrap; }

/* ---- 종합 화면 ---- */
.summary-card { }
.summary-table-wrap { overflow-x: auto; margin-bottom: 24px; }
.summary-table { width: 100%; border-collapse: collapse; }
.summary-table th {
  background: var(--surface2);
  padding: 10px 14px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}
.summary-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: .875rem; }
.summary-table .land-row td { border-left: 3px solid var(--land-color); }
.summary-table .building-row td { border-left: 3px solid var(--building-color); }
.summary-table .unit-row td { border-left: 3px solid var(--unit-color); }
.summary-grand-total td { background: var(--primary-light); font-size: 1rem; font-weight: 700; padding: 14px; }
.grand-total-value { color: var(--primary) !important; font-size: 1.1rem !important; }
.text-right { text-align: right !important; }

.grand-total-box {
  text-align: center;
  background: var(--primary);
  border-radius: var(--radius);
  padding: 24px 32px;
  margin-bottom: 24px;
  color: #fff;
}
.grand-total-label { font-size: .9rem; opacity: .8; margin-bottom: 6px; }
.grand-total-amount { font-size: 2rem; font-weight: 900; letter-spacing: -1px; }

.summary-breakdown {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.breakdown-item {
  flex: 1;
  min-width: 130px;
  text-align: center;
  padding: 16px 12px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
}
.breakdown-item.land-color { border-top: 3px solid var(--land-color); }
.breakdown-item.building-color { border-top: 3px solid var(--building-color); }
.breakdown-item.unit-color { border-top: 3px solid var(--unit-color); }
.breakdown-item.total-color { border-top: 3px solid var(--primary); background: var(--primary-light); }
.breakdown-icon { font-size: 1.2rem; margin-bottom: 6px; }
.breakdown-item.land-color .breakdown-icon { color: var(--land-color); }
.breakdown-item.building-color .breakdown-icon { color: var(--building-color); }
.breakdown-item.unit-color .breakdown-icon { color: var(--unit-color); }
.breakdown-item.total-color .breakdown-icon { color: var(--primary); }
.breakdown-label { font-size: .75rem; color: var(--text-secondary); margin-bottom: 6px; }
.breakdown-value { font-size: .9rem; font-weight: 700; color: var(--text-primary); }
.breakdown-plus { font-size: 1.4rem; color: var(--text-muted); font-weight: 700; flex-shrink: 0; }
.summary-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ═══════════════════════════════════════════
   수수료 자동계산 패널 (보수기준 구간 누진)
   ═══════════════════════════════════════════ */
.fee-auto-panel {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.fee-auto-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.fee-auto-title {
  font-size: .875rem;
  font-weight: 700;
  color: #166534;
}
.fee-auto-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: #15803d;
  cursor: pointer;
  user-select: none;
}
.fee-auto-toggle-label input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: #16a34a;
  cursor: pointer;
}
.fee-auto-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fee-auto-value {
  font-size: .95rem;
  font-weight: 700;
  color: #0f172a;
}

/* 입력 그리드 */
.fee-input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.fee-input-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.fee-input-label {
  font-size: .76rem;
  font-weight: 700;
  color: #166534;
}
.fee-label-hint {
  font-weight: 400;
  color: #6b7280;
  font-size: .72rem;
}
.fee-input-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 배율 프리셋 + 직접입력 */
.fee-mult-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.fee-mult-presets {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.btn-mult-preset {
  padding: 3px 9px;
  border: 1px solid #86efac;
  border-radius: 20px;
  background: #fff;
  color: #166534;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.btn-mult-preset:hover  { background: #dcfce7; }
.btn-mult-preset.active { background: #166534; color: #fff; border-color: #166534; }
.fee-mult-direct {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 3px 8px 3px 10px;
}
.fee-mult-x {
  font-size: .9rem;
  font-weight: 700;
  color: #166534;
  line-height: 1;
}
.fee-mult-direct input[type="number"] {
  width: 60px;
  text-align: center;
  border: none;
  background: transparent;
  font-size: .95rem;
  font-weight: 700;
  color: #14532d;
  outline: none;
  padding: 2px 0;
  -moz-appearance: textfield;
}
.fee-mult-direct input[type="number"]::-webkit-outer-spin-button,
.fee-mult-direct input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.fee-mult-direct input.input-out-of-range {
  color: #dc2626;
  background: #fef2f2;
  border-radius: 4px;
}
.fee-mult-range-hint {
  font-size: .72rem;
  color: #6b7280;
  white-space: nowrap;
  border-left: 1px solid #bbf7d0;
  padding-left: 7px;
  margin-left: 2px;
  line-height: 1.2;
}
.fee-unit-label {
  font-size: .82rem;
  color: #166534;
  font-weight: 600;
}
.fee-rate-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 계산 결과 패널 */
.fee-result-panel {
  background: #fff;
  border: 1px solid #d1fae5;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 48px;
  overflow-x: auto;
}
.fee-hint-text {
  color: #6b7280;
  font-size: .82rem;
  margin: 0;
  padding: 4px 0;
}
.fee-breakdown-wrap { width: 100%; }

/* 계산 내역 통합 테이블 */
.fee-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}
.fee-breakdown-table th {
  background: #dcfce7;
  color: #166534;
  padding: 6px 10px;
  font-weight: 700;
  border: 1px solid #bbf7d0;
  white-space: nowrap;
}
.fee-breakdown-table td {
  padding: 5px 10px;
  border: 1px solid #e5e7eb;
  color: #374151;
}
.fee-breakdown-table tfoot td {
  background: #f8fafc;
  color: #6b7280;
  font-size: .75rem;
  border-top: 2px solid #d1fae5;
}

/* 행별 하이라이트 */
.fee-row-tier td   { background: #f0fdf4; }
.fee-row-mult td   { background: #fffbeb; }
.fee-row-supply td { background: #eff6ff; font-weight: 600; border-top: 2px solid #bfdbfe; }
.fee-row-total td  { background: #166534; color: #fff; font-size: .9rem; }
.fee-row-total td strong { color: #fff; }
.fee-row-rate td   { color: #9ca3af; font-style: italic; }

/* 강조 금액 */
.fee-val-strong { font-weight: 700; color: #1e40af; }
.fee-row-total .fee-val-strong { color: #fff; font-size: 1rem; }

/* 산식 셀 */
.fee-formula {
  font-size: .75rem;
  color: #6b7280;
  font-family: monospace;
}

/* 구간 뱃지 */
.fee-tier-badge {
  display: inline-block;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}

.text-right { text-align: right !important; }

/* 배율 뱃지 */
.fee-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 700;
  margin-left: 4px;
}
.fee-badge-base { background: #e0f2fe; color: #0369a1; }
.fee-badge-up   { background: #fef2f2; color: #b91c1c; }
.fee-badge-down { background: #f0fdf4; color: #15803d; }

/* 적용 버튼 행 */
.fee-apply-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}
.btn-xs {
  padding: 2px 10px;
  font-size: .78rem;
}

/* 구간 요율 참고표 */
.fee-rate-ref {
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.fee-rate-ref-title {
  padding: 7px 12px;
  background: #f0fdf4;
  color: #166534;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.fee-rate-ref-title::-webkit-details-marker { display: none; }
.fee-rate-ref-title::after {
  content: '▸';
  margin-left: auto;
  transition: transform .2s;
}
details[open] .fee-rate-ref-title::after { transform: rotate(90deg); }
.fee-rate-ref-body { padding: 10px 12px; overflow-x: auto; }
.fee-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .75rem;
}
.fee-ref-table th {
  background: #dcfce7;
  color: #166534;
  padding: 5px 10px;
  border: 1px solid #bbf7d0;
  font-weight: 700;
  white-space: nowrap;
}
.fee-ref-table td {
  padding: 4px 10px;
  border: 1px solid #e5e7eb;
  color: #374151;
  white-space: nowrap;
}
.fee-ref-table tr:nth-child(even) td { background: #f9fafb; }
.fee-ref-note {
  font-size: .72rem;
  color: #6b7280;
  margin: 8px 0 0;
  padding: 6px 8px;
  background: #f8fafc;
  border-radius: 4px;
}

/* ---- 견적서 ---- */
.quotation-preview {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  min-height: 500px;
}
.preview-hint { color: var(--text-muted); text-align: center; padding: 60px; }

/* 인쇄용 견적서 */
.quote-doc { font-family: 'Noto Sans KR', sans-serif; max-width: 700px; margin: 0 auto; }
.quote-doc-title { text-align: center; font-size: 2rem; font-weight: 900; letter-spacing: 8px; margin-bottom: 6px; }
.quote-doc-subtitle { text-align: center; color: var(--text-secondary); font-size: .85rem; margin-bottom: 28px; }
.quote-meta-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.quote-meta-table td { padding: 8px 12px; border: 1px solid var(--border); font-size: .875rem; }
.quote-meta-table td:first-child { background: var(--surface2); font-weight: 700; width: 120px; }
.quote-detail-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.quote-detail-table th { background: var(--text-primary); color: #fff; padding: 10px 12px; font-size: .85rem; }
.quote-detail-table td { padding: 10px 12px; border: 1px solid var(--border); font-size: .875rem; }
.quote-detail-table .total-row td { background: var(--primary-light); font-weight: 700; }
.quote-note { font-size: .8rem; color: var(--text-secondary); border: 1px solid var(--border); padding: 12px; border-radius: var(--radius-sm); margin-bottom: 24px; }
.quote-sign { text-align: right; margin-top: 40px; font-size: .9rem; }
.quote-sign strong { display: block; font-size: 1.1rem; margin-bottom: 4px; }

/* ---- 버튼 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-accent { background: linear-gradient(135deg, #7c3aed, #4f46e5); color: #fff; }
.bld-fetch-area { display: flex; align-items: center; gap: 14px; padding: 4px 0; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .78rem; }
.btn-xs { padding: 3px 8px; font-size: .72rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.icon-btn { background: none; border: none; cursor: pointer; color: #fff; padding: 8px; border-radius: var(--radius-sm); font-size: 1.1rem; transition: background .2s; }
.icon-btn:hover { background: rgba(255,255,255,.15); }
.btn-text { background: none; border: none; cursor: pointer; color: var(--primary); font-size: .8rem; text-decoration: underline; padding: 2px 4px; }
.btn-icon-del { background: none; border: none; cursor: pointer; color: var(--danger); padding: 4px 8px; border-radius: 4px; font-size: .85rem; transition: background .2s; }
.btn-icon-del:hover { background: var(--danger-light); }

/* ---- 배지 ---- */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: filter .15s, box-shadow .15s;
  user-select: none;
}
.status-badge:hover { filter: brightness(.93); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.status-draft { background: #fef3c7; color: #92400e; }
.status-done  { background: var(--success-light); color: var(--success); }

/* ---- 상태 드롭다운 ---- */
.status-badge-wrap {
  position: relative;
  display: inline-block;
}
.status-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgba(0,0,0,.13);
  z-index: 200;
  min-width: 120px;
  overflow: hidden;
}
.status-dropdown.open { display: block; }
.status-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: .84rem;
  font-weight: 600;
  text-align: left;
  transition: background .15s;
  color: var(--text-primary);
}
.status-option:hover { background: var(--bg); }
.status-option.active-option { background: var(--primary-light); color: var(--primary); }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.draft { background: #f59e0b; }
.status-dot.done  { background: var(--success); }

/* ── 첨부파일 섹션 ── */
.file-gdrive-hint {
  font-size: .78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.file-count-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 700;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
  min-width: 18px;
  text-align: center;
}
.file-count-badge:empty { display: none; }

/* 드롭존 */
.file-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 4px;
  transition: border-color .2s, background .2s;
  min-height: 80px;
}
.file-drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.file-drop-hint {
  text-align: center;
  padding: 14px 0 10px;
  color: var(--text-muted);
  font-size: .82rem;
  line-height: 1.7;
  pointer-events: none;
}
.file-drop-hint i { font-size: 1.3rem; display: block; margin-bottom: 4px; opacity: .5; }

/* 파일 목록 */
.file-list { display: flex; flex-direction: column; gap: 2px; }
.file-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  color: var(--text-muted);
  font-size: .85rem;
}
.file-empty i { opacity: .4; }

/* 파일 아이템 */
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: background .15s;
}
.file-item:hover { background: var(--primary-light); }

.file-icon {
  width: 34px; height: 34px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.icon-pdf   { background: #fee2e2; color: #dc2626; }
.icon-img   { background: #dbeafe; color: #2563eb; }
.icon-word  { background: #ede9fe; color: #7c3aed; }
.icon-excel { background: #dcfce7; color: #16a34a; }
.icon-etc   { background: #f3f4f6; color: #6b7280; }
.icon-link  { background: #fef9c3; color: #ca8a04; }

.file-info { flex: 1; min-width: 0; }
.file-name {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-name:hover { color: var(--primary); text-decoration: underline; }
.file-meta {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.file-actions { display: flex; gap: 4px; flex-shrink: 0; }
.file-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  text-decoration: none;
  transition: background .15s, color .15s;
  color: var(--text-secondary);
}
.file-btn:hover { background: var(--surface); color: var(--text-primary); }
.file-btn-del:hover { background: #fee2e2; color: #dc2626; }

/* source 배지 (Drive / 링크 구분) */
.file-src-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 4px;
}
.file-src-drive {
  background: #e8f0fe;
  color: #1a73e8;
}
.file-src-r2 {
  background: #fff3e0;
  color: #e65c00;
}
.file-src-link {
  background: #fef9c3;
  color: #92400e;
}

/* 파일 메모 */
.file-memo {
  font-size: .72rem;
  color: var(--text-muted);
  margin-left: 6px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  display: inline-block;
  vertical-align: middle;
}

/* ── 링크 추가 모달 ── */
/* modal-box-sm: 작은 모달 너비 */
.modal-box-sm {
  width: min(480px, 95vw) !important;
}

/* 필수/선택 마크 */
.required-mark {
  color: #ef4444;
  font-size: .8rem;
  margin-left: 2px;
}
.optional-mark {
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 400;
  margin-left: 3px;
}

/* 인풋 아래 힌트 텍스트 */
.form-hint {
  display: block;
  margin-top: 4px;
  font-size: .75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ---- 모달 ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: min(480px, 95vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 1.2rem; color: var(--text-muted); padding: 4px; }
.modal-body { flex: 1; overflow-y: auto; padding: 12px; }

/* ---- 토지 다필지 UI ---- */

/* 통합 검색 입력바 */
.land-input-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1px solid #86efac;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.land-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.land-input-group label {
  font-size: .72rem;
  font-weight: 600;
  color: #15803d;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.land-input-group input,
.land-input-group select {
  padding: 7px 10px;
  border: 1px solid #86efac;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.land-input-group input:focus,
.land-input-group select:focus {
  outline: none;
  border-color: var(--land-color);
  box-shadow: 0 0 0 3px rgba(22,163,74,.15);
}
.land-input-dong  { flex: 2; min-width: 160px; position: relative; }
.land-input-type  { min-width: 70px; }
.land-input-bun   { min-width: 80px; }
.land-input-btn   { }

/* 선택된 법정동 배지 */
.land-dong-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  background: var(--land-light);
  border: 1px solid #86efac;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--land-color);
  margin-bottom: 4px;
}
.land-dong-badge-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: #86efac;
  padding: 0 2px;
  font-size: .8rem;
  line-height: 1;
  transition: color .15s;
}
.land-dong-badge-clear:hover { color: var(--danger); }

/* 추가 버튼 */
.btn-success {
  background: var(--land-color);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background .15s, transform .1s;
}
.btn-success:hover  { background: #15803d; }
.btn-success:active { transform: scale(.97); }

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title-row .section-title { margin-bottom: 0; }

.row-count-badge {
  display: inline-flex;
  align-items: center;
  background: var(--land-light);
  color: var(--land-color);
  border: 1px solid #86efac;
  border-radius: 20px;
  padding: 2px 12px;
  font-size: .78rem;
  font-weight: 700;
}

/* 토지 테이블 */
.land-table { min-width: 800px; }
.land-table th { background: #14532d; color: #fff; }
.land-table tr:hover td { background: #f0fdf4; }
.land-table .land-row-amount { color: var(--land-color); }

/* 토지정보 자동입력 하이라이트 */
@keyframes landAutofill {
  0%   { background: #bbf7d0; }
  100% { background: transparent; }
}
.land-row-autofilled td {
  animation: landAutofill 0.8s ease-out forwards;
}

.table-empty-hint {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.subtotal-row td { background: var(--land-light) !important; }

/* ---- 건물 블록 구조 ---- */
.building-blocks-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.building-block-card {
  background: var(--surface);
  border: 2px solid var(--building-color);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: #fff;
  gap: 12px;
  flex-wrap: wrap;
}
.block-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.block-num {
  font-size: .75rem;
  font-weight: 700;
  background: rgba(255,255,255,.25);
  border-radius: 20px;
  padding: 2px 9px;
  white-space: nowrap;
}
.block-address-text {
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: .95;
}
.block-address-empty {
  font-size: .85rem;
  opacity: .65;
  font-style: italic;
}
.block-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.block-header-actions .btn {
  font-size: .78rem;
  padding: 5px 10px;
  background: rgba(255,255,255,.18);
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
}
.block-header-actions .btn:hover { background: rgba(255,255,255,.32); }
.block-header-actions .btn-danger-ghost {
  background: rgba(239,68,68,.2);
  border-color: rgba(239,68,68,.5);
  color: #fca5a5;
}
.block-header-actions .btn-danger-ghost:hover { background: rgba(239,68,68,.35); }

/* 주소 입력 영역 (접었다 펼치기) */
.block-addr-section {
  padding: 14px 16px;
  background: #f0f7ff;
  border-bottom: 1px solid #bae6fd;
}
.block-addr-section.hidden { display: none; }
.addr-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.addr-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;  /* dropdown-results(position:absolute) 기준점 */
}
.addr-input-group label {
  font-size: .73rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.addr-input-group input,
.addr-input-group select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  background: #fff;
  min-width: 120px;
}
.addr-input-narrow input,
.addr-input-narrow select { min-width: 72px; width: 72px; }
.addr-input-btn { align-self: flex-end; }
.addr-input-group .input-with-btn {
  display: flex;
  gap: 4px;
}
.addr-input-group .input-with-btn input {
  flex: 1;
  min-width: 140px;
}

/* 표제부 정보 헤더 */
.block-title-info {
  background: #eff6ff;
  border-bottom: 1px solid #bfdbfe;
  font-size: .82rem;
}
/* 표제부 — 표시 모드 */
.ti-view-mode {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  flex-wrap: wrap;
}
.ti-items-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  flex: 1;
  align-items: center;
}
.title-info-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.title-info-item strong { color: var(--text-primary); font-weight: 600; }
.title-info-item i { color: #2563eb; font-size: .78rem; }
.ti-empty-hint {
  color: #9ca3af;
  font-style: italic;
  font-size: .8rem;
}
/* [직접 입력] / [수정] 버튼 */
.ti-edit-btn {
  flex-shrink: 0;
  font-size: .75rem;
  padding: 3px 10px;
  border-radius: 5px;
  white-space: nowrap;
  border: 1px solid #9ca3af;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: background .15s;
}
.ti-edit-btn:hover { background: #f3f4f6; border-color: #6b7280; }

/* 표제부 — 편집 모드 */
.ti-edit-mode {
  padding: 12px 16px;
  background: #f8faff;
  border-top: 1px dashed #bfdbfe;
}
.ti-edit-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 10px;
}
.ti-edit-field {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1 1 160px;
  min-width: 140px;
}
.ti-edit-field label {
  font-size: .78rem;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  min-width: 62px;
}
.ti-edit-field input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: .82rem;
  background: #fff;
  min-width: 0;
}
.ti-edit-field input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,.18);
}
.ti-edit-actions {
  display: flex;
  gap: 8px;
}

/* ② 헤더 주소입력 버튼 — 확정 전/후 색상 */
.btn-addr-toggle {
  background: rgba(255,255,255,.18);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,.5);
  font-weight: 600;
  transition: background .15s, border-color .15s;
}
.btn-addr-toggle:hover { background: rgba(255,255,255,.32); }
/* 주소 확정 후: 초록 계열로 변경 */
.btn-addr-confirmed {
  background: rgba(16,185,129,.25) !important;
  border-color: rgba(16,185,129,.7) !important;
  color: #a7f3d0 !important;
}
.btn-addr-confirmed:hover { background: rgba(16,185,129,.4) !important; }

/* ② 건축물대장 버튼 비활성화 */
.block-header-actions .btn:disabled {
  opacity: .38;
  cursor: not-allowed;
  pointer-events: none;
}

/* ⑤ 주소 확정 후 display 바 (건축물대장 버튼 포함) */
.block-addr-confirmed {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 12px;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.addr-confirmed-icon { color: #059669; font-size: .95rem; flex-shrink: 0; }
.addr-confirmed-text {
  flex: 1;
  font-size: .88rem;
  font-weight: 600;
  color: #065f46;
  min-width: 0;
  word-break: break-all;
}
.block-addr-confirmed .btn-success {
  font-size: .8rem;
  padding: 5px 12px;
  flex-shrink: 0;
  background: #059669;
  border-color: #059669;
}
.block-addr-confirmed .btn-success:hover { background: #047857; }
.block-addr-confirmed.hidden { display: none; }

/* ④ 일괄적용 바 — 접힘/펼침 */
.block-bulk-section {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border-bottom: 1px solid #bae6fd;
}
.block-bulk-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  cursor: pointer;
  user-select: none;
  font-size: .82rem;
  font-weight: 700;
  color: #0369a1;
  gap: 8px;
}
.block-bulk-toggle:hover { background: rgba(14,165,233,.08); }
.block-bulk-toggle span { display: flex; align-items: center; gap: 6px; }
.bulk-chevron {
  font-size: .75rem;
  color: #0369a1;
  transition: transform .2s ease;
}
/* 접힌 상태: body 숨김 */
.block-bulk-collapsed .block-bulk-body { display: none; }
/* 펼친 상태: body 표시 */
.block-bulk-body {
  padding: 10px 16px 14px;
}
/* chevron: 펼쳐졌을 때 위로 회전 */
.block-bulk-section:not(.block-bulk-collapsed) .bulk-chevron {
  transform: rotate(180deg);
}

.block-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.block-bulk-field { display: flex; flex-direction: column; gap: 3px; }
.block-bulk-field label { font-size: .73rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.block-bulk-field select,
.block-bulk-field input { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .83rem; background: #fff; width: 100%; }

/* 건물 명세 테이블 영역 */
.block-table-section { padding: 0 0 12px; }
.block-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 6px;
}
.block-table-title { font-size: .85rem; font-weight: 700; color: var(--text-secondary); }
.block-subtotal {
  font-size: .88rem;
  font-weight: 700;
  color: var(--building-color);
  padding: 6px 16px 10px;
  text-align: right;
}

/* 건물 블록 추가 버튼 영역 */
.building-add-area {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  gap: 12px;
}

/* ---- 공통값 일괄적용 바 (A) ---- */
.bulk-apply-card { background: linear-gradient(135deg, #f0f9ff, #e0f2fe); border: 1px solid #bae6fd; }
.bulk-apply-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.bulk-field { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.bulk-field label { font-size: .75rem; font-weight: 600; color: var(--text-secondary); }
.bulk-field select,
.bulk-field input { padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .85rem; background: #fff; }
.btn-group { display: flex; gap: 8px; }

/* ---- 층 범위 모달 (B) ---- */
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  width: min(640px, 95vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.modal-header h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--text-muted); padding: 4px 8px; border-radius: 4px; }
.modal-close:hover { background: var(--border); }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface2); }
.modal-divider { border: none; border-top: 1px solid var(--border); margin: 0; }

.floor-range-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.floor-range-section { background: var(--surface2); border-radius: var(--radius-sm); padding: 14px; }
.floor-range-label { font-size: .85rem; font-weight: 700; margin: 0 0 10px 0; display: flex; align-items: center; gap: 6px; }
.floor-range-label.ground { color: #0369a1; }
.floor-range-label.underground { color: #7c3aed; }
.floor-range-row { display: flex; align-items: flex-end; gap: 8px; }
.floor-range-row .form-group { flex: 1; margin: 0; }
.floor-range-row input { width: 100%; }
.range-tilde { font-size: 1.2rem; font-weight: 700; color: var(--text-muted); padding-bottom: 6px; }

.fr-preview { background: var(--surface2); border-radius: var(--radius-sm); padding: 12px; }
.fr-preview-title { font-size: .82rem; font-weight: 700; color: var(--text-secondary); margin: 0 0 8px 0; }
.fr-preview-list { display: flex; flex-wrap: wrap; gap: 6px; }
.fr-preview-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-primary);
}
.fr-preview-tag.ground { border-color: #0369a1; color: #0369a1; background: #e0f2fe; }
.fr-preview-tag.underground { border-color: #7c3aed; color: #7c3aed; background: #ede9fe; }
.fr-preview-empty { font-size: .82rem; color: var(--text-muted); }

/* ---- 토스트 ---- */
.toast {
  position: fixed;
  bottom: 28px;
  right: 24px;
  background: var(--text-primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  opacity: 0;
  transform: translateY(10px);
  transition: all .3s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }

/* ---- 유틸 ---- */
.hidden { display: none !important; }

/* =============================================
   구분건물 — 표제부 카드 목록
   ============================================= */
.unit-title-hint {
  font-size: .82rem;
  color: #6b7280;
  margin: 0 0 10px;
}
.unit-title-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.unit-title-card {
  background: #f8faff;
  border: 1.5px solid #bfdbfe;
  border-radius: 10px;
  padding: 14px 16px;
  flex: 1 1 260px;
  max-width: 360px;
  cursor: default;
  transition: border-color .15s, box-shadow .15s;
}
.unit-title-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 10px rgba(59,130,246,.15);
}
.utc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.utc-bldnm {
  font-weight: 700;
  font-size: .92rem;
  color: var(--text-primary);
}
.utc-badge {
  background: #dbeafe;
  color: #1d4ed8;
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.utc-info {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: .78rem;
  color: #4b5563;
  margin-bottom: 10px;
}
.utc-info span { display: flex; align-items: center; gap: 4px; }
.utc-info i { color: #6b7280; font-size: .72rem; }
.utc-action { display: flex; justify-content: flex-end; }

/* =============================================
   구분건물 — 호 선택 모달
   ============================================= */
.modal-box-lg {
  width: min(760px, 96vw);
}
.uho-loading {
  text-align: center;
  padding: 24px;
  color: #6b7280;
  font-size: .9rem;
}
.uho-empty {
  text-align: center;
  padding: 24px;
  color: #9ca3af;
  font-size: .88rem;
}
.uho-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 10px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 8px;
}
.uho-check-all {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}
.uho-count-hint {
  font-size: .78rem;
  color: #9ca3af;
}
.uho-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}
.uho-table thead th {
  background: #f1f5f9;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1.5px solid #e2e8f0;
  white-space: nowrap;
}
.uho-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background .1s;
}
.uho-table tbody tr:hover { background: #f8faff; }
.uho-table tbody td {
  padding: 7px 10px;
  color: var(--text-primary);
}

/* =============================================
   구분건물 — 목록 블록 (표제부 헤더 + 호 테이블)
   ============================================= */
/* ─── 구분건물 블록 컨테이너 ─── */
.unit-blocks-container {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* 구분건물 블록 내 표제부 선택 영역 */
.unit-title-section {
  background: #f0fdf4;
  border-top: 1px solid #bbf7d0;
  padding: 10px 14px;
}
.unit-title-section.hidden { display: none; }
.unit-title-section-header {
  font-size: .82rem;
  color: #166534;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.unit-block-header {
  background: #eff6ff;
  border-bottom: 1px solid #bfdbfe;
  font-size: .82rem;
}
.unit-ti-view {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  flex-wrap: wrap;
}
.unit-table-wrap {
  overflow-x: auto;
}
.unit-rows-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}
.unit-rows-table thead th {
  background: #f8fafc;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1.5px solid #e2e8f0;
  white-space: nowrap;
}
.unit-rows-table tbody tr { border-bottom: 1px solid #f1f5f9; }
.unit-rows-table tbody tr:hover { background: #fafafa; }
.unit-rows-table tbody td { padding: 6px 8px; }
.unit-rows-table input {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: .82rem;
}
.unit-rows-table input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,.15);
}
.unit-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}
.unit-subtotal {
  font-weight: 700;
  font-size: .9rem;
  color: var(--text-primary);
}

/* ---- 인쇄 ---- */
@media print {
  #app-header, #sidebar, .tab-nav, .editor-topbar, .editor-actions, .summary-actions,
  button, .btn, .copy-address-row, .address-input-area, .table-hint { display: none !important; }
  #main-content { overflow: visible !important; }
  .quotation-preview { border: none; padding: 0; }
  body { overflow: visible; height: auto; }
  #app { overflow: visible; height: auto; }
  .section-card { box-shadow: none; border: 1px solid #e2e8f0; }
  #tab-contents { padding: 0; }
}

/* ---- 경고 배지 ---- */
.warn-badge {
  display: inline-block; background: #fef3c7; color: #92400e;
  padding: 2px 8px; border-radius: 4px; font-size: .75rem; font-weight: 600;
}
.error-badge {
  display: inline-block; background: #fef2f2; color: #dc2626;
  padding: 2px 8px; border-radius: 4px; font-size: .75rem; font-weight: 600;
}

/* ---- 반응형 ---- */
@media (max-width: 900px) {
  :root { --sidebar-w: 240px; }
  .form-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 680px) {
  #sidebar { position: fixed; left: 0; top: var(--header-h); bottom: 0; z-index: 200; width: var(--sidebar-w); transform: translateX(0); transition: transform .3s; }
  #sidebar.collapsed { transform: translateX(-100%); width: var(--sidebar-w); }
  #main-wrapper { flex-direction: column; }
  .summary-breakdown { flex-direction: column; }
  .breakdown-plus { transform: rotate(90deg); }
  .editor-topbar { flex-direction: column; align-items: flex-start; }
  #tab-contents { padding: 12px; }
}

/* 스크롤바 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--secondary); }
