@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700;800;900&display=swap');

/* ── 디자인 토큰 ─────────────────────────────────────── */
:root {
  --green:        #3ECF8E;
  --green-dark:   #2aab72;
  --green-light:  #E6FFF4;
  --bg:           #F3F4F6;
  --bg-card:      #ffffff;
  --fg:           #111827;
  --fg-secondary: #9CA3AF;
  --border:       #E5E7EB;
  --sidebar-w:    264px;
  --panel-w:      336px;
  --font:         'Noto Sans KR', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font); background: var(--bg-card); color: var(--fg); }

/* ── 전체 레이아웃 ──────────────────────────────────── */
#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--panel-w);
  height: 100vh;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════
   사이드바
══════════════════════════════════════════════════════ */
#sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  height: 83px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 25px;
  gap: 12px;
  flex-shrink: 0;
}
.brand-icon {
  width: 44px; height: 44px;
  background: var(--green);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.brand-name { font-weight: 900; font-size: 19px; }
.brand-sub  { font-size: 12px; color: var(--fg-secondary); }

.sidebar-section { padding: 8px 0 0; }
.sidebar-label {
  font-size: 12px;
  color: var(--fg-secondary);
  font-weight: 500;
  padding: 8px 19px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: 0 6px;
  border-radius: 10px;
  cursor: pointer;
  color: #4B5563;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  gap: 10px;
  transition: background 0.15s;
}
.nav-item:hover                { background: var(--bg); }
.nav-item.active               { background: var(--green-light); color: var(--green); font-weight: 600; }
.nav-item.disabled             { opacity: .5; pointer-events: none; }
.nav-left  { display: flex; align-items: center; gap: 10px; }
.nav-icon  { font-size: 22px; }
.nav-badge { background: var(--green); color: white; border-radius: 10px; font-size: 12px; font-weight: 700; padding: 2px 7px; }
.nav-pct   { background: var(--bg); color: var(--fg-secondary); border-radius: 10px; font-size: 12px; font-weight: 700; padding: 2px 7px; }

/* 현재 검색 조건 */
#current-conditions {
  margin: 8px;
  background: var(--green-light);
  border-radius: 10px;
  padding: 12px 16px;
}
#current-conditions .sidebar-label {
  font-weight: 800;
  font-size: 13.5px;
  color: var(--green);
  padding: 0 0 8px;
}
.search-condition {
  display: flex;
  gap: 6px;
  font-size: 13px;
  color: var(--green);
  margin-bottom: 4px;
}
.search-condition .dot { display: none; }

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 0;
}
.sidebar-bottom .sidebar-label { padding: 12px 19px 4px; }
.user-chip {
  height: 64px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 17px;
  border-top: 1px solid var(--border);
}
.user-avatar {
  width: 41px; height: 41px;
  background: var(--green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.user-name { font-size: 15px; font-weight: 700; }
.user-sub  { font-size: 12px; color: var(--fg-secondary); }

/* ══════════════════════════════════════════════════════
   채팅 영역
══════════════════════════════════════════════════════ */
#chat-area {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
}

/* 상단 헤더 */
#chat-header {
  height: 72px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 29px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#chat-title { font-weight: 900; font-size: 20px; }

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
#reset-btn {
  background: transparent;
  color: var(--fg-secondary);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
#reset-btn:hover { background: var(--bg-hover, #f3f4f6); color: var(--fg); }
#result-btn {
  background: var(--green);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  display: none;
  transition: background 0.15s;
}
#result-btn:hover    { background: var(--green-dark); }
#result-btn.visible  { display: inline-block; }

/* 메시지 스크롤 영역 */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── 말풍선 ─────────────────────────────────────────── */
.msg-group {
  display: flex;
  flex-direction: column;
}
.msg-group.bot  { align-items: flex-start; }
.msg-group.user { align-items: flex-end; }

.bubble {
  max-width: 433px;
  padding: 20px;
  font-size: 15.5px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.bubble.bot {
  background: var(--bg-card);
  border-radius: 18px;
  color: var(--fg);
}
.bubble.user {
  background: var(--green);
  border-radius: 18px;
  color: white;
  padding: 14px 20px;
}

.msg-time {
  font-size: 12px;
  color: var(--fg-secondary);
  margin-top: 4px;
}

/* 타이핑 */
.typing-dots { padding: 20px; }
.typing-dots span {
  display: inline-block;
  width: 7px; height: 7px;
  background: #d1d5db;
  border-radius: 50%;
  margin: 0 2px;
  animation: blink 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100%{opacity:.2} 40%{opacity:1} }

/* ── 빠른 옵션 ──────────────────────────────────────── */
#quick-options {
  padding: 0 40px 16px;
  background: var(--bg);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* 버튼이 있을 때만 상단 구분선 + 레이블 표시 */
#quick-options:not(:empty) {
  border-top: 1.5px solid var(--border);
  padding-top: 10px;
}
#quick-options:not(:empty)::before {
  content: '💡 빠른 선택';
  flex: 0 0 100%;
  font-size: 12px;
  color: var(--fg-secondary);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}
.quick-btn {
  border: 2px solid var(--green);
  background: white;
  border-radius: 20px;
  padding: 10px 18px;
  color: var(--green);
  font-weight: 700;
  font-size: 15.5px;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s, color 0.15s;
}
.quick-btn:hover { background: var(--green); color: white; }
/* 이전으로 ↩ 버튼 — 보조(회색) 스타일 */
.quick-btn.quick-btn-prev {
  border-color: var(--border);
  color: var(--fg-secondary);
  font-weight: 500;
}
.quick-btn.quick-btn-prev:hover { background: var(--bg); color: var(--fg); }

/* ── 입력창 ─────────────────────────────────────────── */
#input-area {
  height: 73px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 0 23px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
#user-input {
  flex: 1;
  background: var(--bg);
  border: none;
  border-radius: 25px;
  padding: 15px 20px;
  font-size: 16px;
  font-family: var(--font);
  outline: none;
  color: var(--fg);
  resize: none;
  line-height: 1.5;
  max-height: 100px;
}
#user-input::placeholder { color: var(--fg-secondary); }
#send-btn {
  width: 47px; height: 47px;
  background: var(--green);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
#send-btn:hover    { background: var(--green-dark); }
#send-btn:disabled { background: #d1d5db; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════
   우측 패널
══════════════════════════════════════════════════════ */
#right-panel {
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#panel-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* 섹션 */
.panel-section {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-section-title {
  font-size: 14px;
  font-weight: 800;
  color: #4B5563;
  margin-bottom: 16px;
}

/* 조건 진행도 */
.progress-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.prog-badge {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 500;
  flex-shrink: 0;
}
.prog-badge.done    { background: var(--green); color: white; }
.prog-badge.current { background: #B8F5DA; border: 2px solid var(--green); color: var(--green); }
.prog-badge.pending { background: white; border: 2px solid var(--border); color: var(--fg-secondary); }

.prog-label         { font-size: 14px; font-weight: 800; color: var(--fg); }
.prog-label.done    { font-size: 14px; font-weight: 600; color: var(--green); }
.prog-label.pending { font-size: 14px; font-weight: 800; color: var(--fg-secondary); }
.prog-value {
  margin-left: auto;
  font-size: 13px;
  color: var(--green);
  font-weight: 700;
  text-align: right;
  max-width: 100px;
}

/* 입력된 조건 */
.condition-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 8px;
}
.cond-label { color: var(--fg-secondary); font-weight: 600; }
.cond-val   { color: var(--green); font-weight: 700; }
.cond-empty { color: var(--fg); font-weight: 700; }

/* 빠른 이동 */
.quick-link {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: #4B5563;
  transition: background 0.15s;
  border: none;
}
.quick-link:hover { background: var(--green-light); }
.quick-link .ql-icon { font-size: 20px; }

/* 추천 결과 카드 */
#results-section { padding: 20px 16px; }
.result-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--bg);
  transition: background 0.15s;
}
.result-card:hover { background: var(--green-light); }
.result-rank { font-size: 12px; color: var(--green); font-weight: 700; margin-bottom: 4px; }
.result-loc  { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--fg); }
.result-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.result-tag  { background: white; border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; font-size: 12px; color: #4B5563; }

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 반응형 ─────────────────────────────────────────── */
@media (max-width: 1200px) {
  #app { grid-template-columns: var(--sidebar-w) 1fr; }
  #right-panel { display: none; }
}
@media (max-width: 768px) {
  #app { grid-template-columns: 1fr; }
  #sidebar { display: none; }
  #messages { padding: 16px; }
  #quick-options { padding: 0 16px 12px; }
  .bubble { max-width: 90%; }
}

/* ══════════════════════════════════════════════════════
   주거 추천 결과 페이지 (#app-rec)
══════════════════════════════════════════════════════ */
#app-rec {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── 추천 메인 영역 ─────────────────────────────────── */
#rec-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* 페이지 헤더 */
#rec-page-header {
  height: 72px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#rec-page-title-wrap { display: flex; align-items: baseline; gap: 10px; }
#rec-page-title      { font-size: 20px; font-weight: 900; }
#rec-page-subtitle   { font-size: 13px; color: var(--fg-secondary); }

.rec-back-btn {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-secondary);
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.15s;
}
.rec-back-btn:hover { background: var(--bg); color: var(--fg); }

/* 로딩·에러·세션없음 공통 */
#rec-loading,
#rec-error,
#rec-no-session {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--fg-secondary);
  font-size: 15px;
  text-align: center;
  line-height: 1.6;
}
.rec-empty-icon { font-size: 48px; }
.rec-retry-btn {
  display: inline-block;
  margin-top: 8px;
  background: var(--green);
  color: white;
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
}
.rec-retry-btn:hover { background: var(--green-dark); }

/* 결과 영역 스크롤 */
#rec-results {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 40px;
}

/* ── 검색 조건 요약 바 ──────────────────────────────── */
#rec-summary-bar {
  margin-bottom: 20px;
}
.rec-summary-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  flex-wrap: wrap;
}
.rec-summary-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-secondary);
  white-space: nowrap;
}
.rec-summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}
.rec-summary-chip {
  background: var(--green-light);
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}
.rec-rerun-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.rec-rerun-btn:hover { color: var(--green); }

/* ── 추천 결과 페이지 — 레퍼런스 (min05ji26/Seoul_housing) UI 포팅 ── */

/* 상단 컨트롤 바 */
.rec-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}
.rec-controls-left {
  display: flex;
  gap: 10px;
  align-items: center;
}
.rec-count-btn {
  background: white;
  border: 1.5px solid var(--green);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  cursor: pointer;
  font-family: inherit;
}
.rec-sort-btn {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-secondary);
  cursor: pointer;
  font-family: inherit;
}
.rec-view-toggle {
  display: flex;
  gap: 8px;
}
.rec-view-btn {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #9CA3AF;
  cursor: pointer;
  font-family: inherit;
}
.rec-view-btn.active {
  border-color: var(--green);
  color: var(--green);
}

/* 조건 칩 바 */
.rec-condition-bar {
  background: #E6FFF4;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.rec-cond-sep { color: #9CA3AF; }

/* 1위 hero 카드 */
.rec-top-card {
  background: white;
  border-radius: 16px;
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.rec-top-image {
  width: 280px;
  min-height: 200px;
  background: linear-gradient(135deg, #3ECF8E, #2D6A4F);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.rec-rank-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: white;
  z-index: 2;
}
.rec-score-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #1B1B1B;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
  color: white;
  z-index: 2;
}
.rec-heart-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  border: none;
  z-index: 2;
}
.rec-top-content { flex: 1; padding: 24px; }
.rec-address {
  font-size: 16px;
  font-weight: 800;
  color: #111827;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rec-detail {
  font-size: 12px;
  color: #9CA3AF;
  margin-bottom: 12px;
}
.rec-price {
  font-size: 22px;
  font-weight: 900;
  color: var(--green);
  margin-bottom: 4px;
}
.rec-mgmt {
  font-size: 11px;
  color: #9CA3AF;
  margin-bottom: 16px;
  font-style: italic;
}
.rec-scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.rec-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #4B5563;
}
.rec-score-row > span:first-child {
  width: 38px;
  flex-shrink: 0;
  font-weight: 600;
}
.rec-score-bar {
  flex: 1;
  height: 6px;
  background: #E5E7EB;
  border-radius: 3px;
  overflow: hidden;
}
.rec-score-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.5s ease;
}
.rec-score-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  min-width: 36px;
  text-align: right;
  flex-shrink: 0;
}
.rec-policy {
  background: #E6FFF4;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #2D6A4F;
  font-weight: 600;
  margin-bottom: 12px;
}
.rec-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.rec-tag {
  background: #F3F4F6;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  color: #4B5563;
  font-weight: 600;
}

/* 2~N위 그리드 카드 */
.rec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.rec-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.15s;
}
.rec-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}
.rec-card-image {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
}
.rec-card-image.blue  { background: linear-gradient(135deg, #93C5FD, #3B82F6); }
.rec-card-image.green { background: linear-gradient(135deg, #6EE7B7, #059669); }
.rec-card-image.gray  { background: #E5E7EB; }
.rec-card-body { padding: 14px; }
.rec-card-rank {
  font-size: 11px;
  color: #9CA3AF;
  font-weight: 600;
  margin-bottom: 4px;
}
.rec-card-addr {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 6px;
}
.rec-card-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 8px;
}
.rec-card-info {
  font-size: 12px;
  color: #9CA3AF;
  margin-bottom: 4px;
}
.rec-card-policy {
  font-size: 11px;
  color: var(--green);
  font-weight: 600;
}

/* 더보기 카드 */
.rec-more-card {
  background: #F3F4F6;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  min-height: 200px;
  text-align: center;
  padding: 16px;
}
.rec-more-card:hover { background: #E5E7EB; }
.rec-more-title {
  font-size: 13px;
  font-weight: 700;
  color: #4B5563;
}
.rec-more-sub {
  font-size: 12px;
  color: #9CA3AF;
}
.rec-more-btn {
  background: var(--green);
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  font-family: inherit;
  margin-top: 4px;
}

/* 지도뷰 (카카오맵) */
#rec-map-view {
  background: white;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  position: relative;
}
#rec-map-canvas {
  width: 100%;
  height: 640px;
  border-radius: 12px;
  background: #E5E7EB;
}
.rec-map-error {
  padding: 40px 20px;
  text-align: center;
  color: #991B1B;
  background: #FEE2E2;
  border-radius: 12px;
  font-size: 14px;
}
#rec-map-legend {
  display: flex;
  gap: 16px;
  padding: 10px 14px 4px;
  font-size: 12px;
  color: #4B5563;
  flex-wrap: wrap;
}
.rec-map-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.rec-map-legend-item .dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block;
}
.rec-map-legend-item .dot--green { background: #10B981; }
.rec-map-legend-item .dot--red   { background: #EF4444; }
.rec-map-legend-item .dot--circle {
  background: rgba(16,185,129,0.15);
  border: 2px dashed #10B981;
}

/* 매물 마커 위 커스텀 라벨 */
.rec-map-marker-label {
  background: white;
  border: 1px solid #D1D5DB;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #1F2937;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  white-space: nowrap;
  pointer-events: none;
  transform: translateY(-2px);
}
.rec-map-marker-name {
  font-size: 12px;
  color: #111827;
  margin-bottom: 2px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rec-map-marker-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  color: #4B5563;
}
.rec-map-marker-score { color: #F59E0B; font-weight: 700; }
.rec-map-marker-price { color: #059669; font-weight: 700; }

/* 구 placeholder 호환 */
.rec-map-sub { display: block; margin-top: 8px; font-size: 13px; color: #9CA3AF; }

/* ── 청년정책 매칭 섹션 (카드 내부) ────────────────── */
.rec-policy-section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rec-policy-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #f59e0b;
}
.rec-policy-icon { font-size: 14px; }

.rec-policy-list { display: flex; flex-direction: column; gap: 8px; }

.rec-policy-item {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.rec-policy-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rec-policy-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  line-height: 1.3;
}
a.rec-policy-name:hover { color: #f59e0b; text-decoration: underline; }

.rec-policy-dup {
  font-size: 10px;
  font-weight: 700;
  color: #ef4444;
  background: #fee2e2;
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
}
.rec-policy-desc {
  font-size: 11px;
  color: var(--fg-secondary);
  line-height: 1.4;
}
.rec-policy-saving {
  font-size: 12px;
  font-weight: 600;
  color: #d97706;
}

/* ── 서울 평균 비교 섹션 ────────────────────────────── */
#rec-avg-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rec-avg-chip {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-secondary);
}
.rec-avg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}
.rec-avg-label  { font-weight: 600; min-width: 80px; }
.rec-avg-good   { color: var(--green); font-weight: 700; }
.rec-avg-bad    { color: #ef4444;      font-weight: 700; }

/* ── 추천 페이지 반응형 ─────────────────────────────── */
@media (max-width: 1024px) {
  .rec-grid { grid-template-columns: repeat(2, 1fr); }
  .rec-top-image { width: 200px; }
  .rec-scores { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  #app-rec { grid-template-columns: 1fr; }
  #app-rec #sidebar { display: none; }
  #rec-results { padding: 16px; }
  #rec-page-header { padding: 0 16px; }
  .rec-top-card { flex-direction: column; }
  .rec-top-image { width: 100%; height: 160px; }
  .rec-grid { grid-template-columns: 1fr; }
  .rec-controls { flex-direction: column; align-items: stretch; }
}

/* ════════════════════════════════════════════════════════
   v6.0 — 매물 상세 모달 (property-modal)
   디자인 토큰: Primary #3ECF8E / Header #1F4A38→#2C674D / Blue #2663EB
   ════════════════════════════════════════════════════════ */

.property-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  overflow-y: auto;
  padding: 40px 20px;
}

.property-modal {
  width: 100%;
  max-width: 1090px;
  background: #FFFFFF;
  border-radius: 20px;
  font-family: 'Noto Sans KR', sans-serif;
  position: relative;
  overflow: hidden;
}

/* 클릭 시 카드 hover 효과 (커서 포인터) */
.rec-top-card,
.rec-card {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.rec-top-card:hover,
.rec-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

/* 모달 헤더 */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #E5E7EB;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #000000;
}
.modal-close-btn {
  width: 37px;
  height: 37px;
  background: #F3F4F6;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #4B5563;
  cursor: pointer;
}
.modal-close-btn:hover { background: #E5E7EB; }

/* 매물 요약 카드 */
.property-summary-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 24px;
  padding: 16px;
  background: #E6FFF4;
  border-radius: 15px;
}
.property-icon-box {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  background: #57D79A;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.property-summary-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.property-address {
  font-size: 16px;
  font-weight: 700;
  color: #000000;
}
.property-meta {
  font-size: 13px;
  font-weight: 500;
  color: #4B5563;
}
.property-deposit {
  font-size: 15px;
  font-weight: 800;
  color: #3ECF8E;
  margin-top: 4px;
}
.property-summary-tags {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.property-summary-tags .tag-pill {
  background: #FFFFFF;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.tag-pill--score   { color: #3ECF8E; }
.tag-pill--commute { color: #2663EB; }
.tag-pill--policy  { color: #2BB87A; }

/* 섹션 타이틀 */
.modal-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #000000;
  padding: 0 24px;
  margin: 16px 0 12px;
}

/* 예상 생활비 + 비교 (2-col grid) */
.modal-grid-2 {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  margin: 0 24px 24px;
}
.expense-receipt {
  background: #FFFFFF;
  border-radius: 20px;
  border: 1px solid #E5E7EB;
  overflow: hidden;
}
.expense-receipt-header {
  background: linear-gradient(180deg, #1F4A38 50%, #2C674D 100%);
  padding: 20px 24px;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.expense-receipt-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.expense-receipt-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: #FFFFFF;
}
.expense-receipt-icon {
  font-size: 30px;
}
.expense-receipt-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: #E5E7EB;
  opacity: 0.85;
}
.expense-receipt-date {
  font-size: 12px;
  font-weight: 400;
  color: #E5E7EB;
  opacity: 0.7;
}
.expense-receipt-body {
  padding: 24px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.expense-placeholder {
  font-size: 13px;
  color: #9CA3AF;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.expense-placeholder-sub {
  font-size: 11px;
  color: #C0C4CC;
}
.comparison-card {
  background: #FFFFFF;
  border: 2px solid #E5E7EB;
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 280px;
}
.comparison-card-title {
  font-size: 16px;
  font-weight: 900;
  color: #000000;
}

/* 청년정책 섹션 */
.policy-section {
  margin: 0 24px 24px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 20px;
  overflow: hidden;
}
.policy-section-header {
  background: #3ECF8E;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.policy-section-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.policy-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #000000;
}
.policy-section-subtitle {
  font-size: 14px;
  font-weight: 800;
  color: #FFFFFF;
}
.policy-section-property-name {
  font-size: 12px;
  font-weight: 500;
  color: #FFFFFF;
  opacity: 0.75;
}
.policy-savings-pill {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 800;
  color: #3ECF8E;
  white-space: nowrap;
}
.policy-list {
  display: flex;
  flex-direction: column;
}
.policy-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid #E5E7EB;
}
.policy-item:last-child {
  border-bottom: none;
}
.policy-item--needs-check {
  background: #FAFBFC;
}
.policy-item--gu-specific {
  background: #F0FDF7;
}
.policy-icon-box {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: #F3F4F6;
}
.policy-icon-box--monthly       { background: #E6FFF4; }
.policy-icon-box--deposit-loan  { background: #EFF6FF; }
.policy-icon-box--rental         { background: #F8F8FA; }
.policy-icon-box--needs-check    { opacity: 0.7; }
.policy-item-body {
  flex: 1;
  min-width: 0;
}
.policy-item-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.policy-item-name {
  font-size: 15px;
  font-weight: 800;
  color: #111827;
}
.policy-item-name--disabled {
  color: #4B5563;
  opacity: 0.7;
}
.policy-label {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.policy-label--eligible {
  background: #E6FFF4;
  color: #3ECF8E;
}
.policy-label--needs-check {
  background: #F3F4F6;
  color: #6B7280;
}
.policy-label--gu {
  background: #DCFCE7;
  color: #166534;
}
.policy-item-desc {
  font-size: 13px;
  font-weight: 500;
  color: #4B5563;
  margin-top: 6px;
  line-height: 1.45;
}
.policy-item-desc--disabled {
  opacity: 0.75;
}
.policy-tag-list {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.policy-tag {
  height: 20px;
  padding: 0 8px;
  background: #F3F4F6;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  color: #6B7280;
}
.policy-item-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #2663EB;
  text-decoration: none;
}
.policy-item-link:hover { text-decoration: underline; }
.policy-show-more {
  display: block;
  width: 100%;
  padding: 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #3ECF8E;
  background: transparent;
  border: none;
  border-top: 1px solid #E5E7EB;
  cursor: pointer;
}
.policy-show-more:hover { background: #F8F8FA; }
.policy-empty {
  padding: 32px 24px;
  text-align: center;
  font-size: 13px;
  color: #9CA3AF;
}

/* 모달 푸터 */
.modal-footer-note {
  padding: 16px 24px 24px;
  font-size: 11px;
  color: #9CA3AF;
  text-align: center;
  line-height: 1.5;
}

/* body 스크롤락 (모달 열려있는 동안) */
body.modal-open {
  overflow: hidden;
}

/* 반응형 */
@media (max-width: 768px) {
  .property-modal-overlay { padding: 16px 8px; }
  .property-modal { border-radius: 14px; }
  .property-summary-card { flex-direction: column; align-items: stretch; }
  .property-summary-tags { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .modal-grid-2 { grid-template-columns: 1fr; }
  .policy-section-header { flex-direction: column; align-items: flex-start; }
}


/* ══════════════════════════════════════════════════════
   예상 생활비 영수증 (Step 4 — /api/expense)
══════════════════════════════════════════════════════ */

/* 영수증 본문 — 기존 placeholder용 정렬을 항목 리스트용으로 재정의 */
.expense-receipt-body {
  padding: 20px 24px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  justify-content: flex-start;
}

.receipt-section { display: flex; flex-direction: column; gap: 4px; }
.receipt-section-header {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: var(--fg);
}
.receipt-section-icon { font-size: 14px; }
.receipt-section-sub {
  font-size: 11px; color: var(--fg-secondary);
  font-weight: 400; margin-left: 2px;
}
.receipt-line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 2px 0 2px 22px; font-size: 13px; color: var(--fg);
}
.receipt-line--solo { justify-content: flex-end; }
.receipt-line-label { color: var(--fg-secondary); }
.receipt-line-value { font-weight: 600; }

.receipt-divider {
  border-top: 1px dashed var(--border);
  margin: 8px 0 4px;
}
.receipt-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 4px;
}
.receipt-total-label { font-size: 14px; font-weight: 700; color: var(--fg); }
.receipt-total-value { font-size: 22px; font-weight: 900; color: var(--green-dark); }

.receipt-footnote {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--fg-secondary); line-height: 1.4;
}
.receipt-footnote-sub { font-size: 10px; opacity: 0.85; }

/* 스켈레톤 (영수증/비교카드 fetch 중 표시) */
.expense-skeleton {
  display: flex; flex-direction: column; gap: 10px; width: 100%;
}
.skeleton-line {
  height: 12px;
  background: linear-gradient(90deg, var(--border) 0%, #F3F4F6 50%, var(--border) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s infinite;
  border-radius: 6px;
}
.skeleton-line--lg { height: 18px; }
@keyframes skeleton-shimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

/* 비교카드 가로 막대 */
.comparison-bars { display: flex; flex-direction: column; gap: 10px; }
.comparison-bar-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "label meta" "track track";
  gap: 4px 8px; align-items: center;
}
.comparison-bar-label {
  grid-area: label;
  font-size: 12px; font-weight: 600; color: var(--fg);
}
.comparison-bar-meta {
  grid-area: meta;
  display: flex; gap: 8px; align-items: baseline;
}
.comparison-bar-amount { font-size: 12px; font-weight: 700; color: var(--fg); }
.comparison-bar-pct {
  font-size: 11px; color: var(--fg-secondary);
  min-width: 32px; text-align: right;
}
.comparison-bar-track {
  grid-area: track; height: 6px;
  background: var(--bg);
  border-radius: 3px; overflow: hidden;
}
.comparison-bar-fill {
  height: 100%; background: var(--green);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* target 강조 (★ 현재 매물) */
.comparison-bar-row--target .comparison-bar-fill { background: var(--green-dark); }
.comparison-bar-row--target .comparison-bar-label {
  color: var(--green-dark); font-weight: 800;
}

/* 서울 평균 — 회색 기준선 + 점선 윗구분 */
.comparison-bar-row--avg .comparison-bar-fill { background: var(--fg-secondary); }
.comparison-bar-row--avg .comparison-bar-label { color: var(--fg-secondary); }
.comparison-bar-row--avg {
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 4px;
}

/* 비교카드 풀어쓴 텍스트 박스 */
.comparison-explain {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--green-light);
  border-radius: 8px;
}
.comparison-explain-head {
  font-size: 11px; font-weight: 700;
  color: var(--green-dark);
}
.comparison-explain-sub {
  font-size: 10px; color: var(--fg-secondary);
  margin-top: 2px; line-height: 1.4;
}

/* SVG 도넛 + 범례 */
.comparison-donut-section {
  display: flex; align-items: center; gap: 14px;
  margin-top: 4px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.comparison-donut-wrap { width: 100px; height: 100px; flex-shrink: 0; }
.comparison-donut { width: 100%; height: 100%; }
.donut-center-num { font-size: 16px; font-weight: 900; fill: var(--fg); }
.donut-center-unit { font-size: 9px; fill: var(--fg-secondary); }

.comparison-donut-legend {
  display: flex; flex-direction: column; gap: 6px; flex: 1;
}
.donut-legend-row {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
}
.donut-legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%; flex-shrink: 0;
}
.donut-legend-label { flex: 1; color: var(--fg); }
.donut-legend-value { color: var(--fg-secondary); font-weight: 600; }
