:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #e3e8ef;
  --text: #1d2733;
  --muted: #66707d;
  --accent: #2563eb;
  --accent-soft: #eaf1fe;
  --up: #d92d20;
  --down: #175cd3;
  --good: #067647;
  --bad: #b42318;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

/* ===== 헤더 ===== */
header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  z-index: 1100;
}

header h1 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.02em;
  white-space: nowrap;
}
header h1 span { color: var(--accent); }

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.controls label { color: var(--muted); font-size: 12px; }

/* hidden 속성이 display:flex 같은 클래스 규칙에 지지 않게 */
[hidden] { display: none !important; }

/* 광고 슬롯 — 설정이 없으면 hidden이라 흔적이 없다 */
.ad-slot { display: flex; justify-content: center; padding: 6px 12px; background: #fff; border-bottom: 1px solid var(--line); }
#adPanel { border-bottom: 0; border-top: 1px solid var(--line); }
.detail-panel .ad-slot { border: 0; padding: 8px 0 0; }
.ad-box { position: relative; overflow: hidden; width: 100%; }
.ad-box iframe { display: block; max-width: 100%; }
.ad-disclosure { font-size: 13px; color: #3b4452; margin: 0 0 4px; line-height: 1.4; }
.ad-tag { position: absolute; top: 0; right: 0; font-size: 10.5px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); background: #fff; }
.ad-label { font-size: 15px; font-weight: 800; color: #b45309; background: #fff7ed; border-radius: 4px; padding: 0 6px; }

/* 상단 영상 바 — 클릭 전엔 얇은 바만 (지도 높이와 쿠키 모두 아낀다) */
.promo-top { border-bottom: 1px solid var(--line); background: #fff; }
.promo-bar { display: flex; align-items: center; gap: 10px; padding: 6px 14px; }
.promo-thumb { width: 64px; height: 36px; object-fit: cover; border-radius: 4px; flex: none; }
.promo-text { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.promo-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.promo-kind, .promo-sponsor { color: var(--muted); font-size: 12px; }
.promo-play { border: 1px solid #e00; color: #e00; background: #fff; border-radius: 7px; height: 30px; padding: 0 12px; font-weight: 700; cursor: pointer; font-family: inherit; }
.promo-close { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.promo-player { height: min(40vh, 405px); width: auto; max-width: 100%; margin: 0 auto 8px; aspect-ratio: 16 / 9; }
.promo-player iframe { width: 100%; height: 100%; border: 0; display: block; }

/* 동네별 추천 중개업소 (광고) — 목록 패널 위, 실거래 순위와 분리 */
.agency-card { padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fffdf7; }
.agency-card summary { cursor: pointer; font-weight: 700; font-size: 13px; list-style: none; }
.agency-card summary::-webkit-details-marker { display: none; }
.agency-card summary small { color: var(--muted); font-weight: 500; }
.agency-item { font-size: 12.5px; line-height: 1.55; padding: 8px 0; border-top: 1px solid #f0f2f5; }
.agency-item .blurb { color: #475467; }
.agency-foot { font-size: 11px; color: var(--muted); margin-top: 4px; }
@media (max-width: 860px) { .ad-box { max-width: 100%; } .promo-title { max-width: 45vw; } }
/* 단지명 검색 — 결과는 입력창 아래 팝오버로 */
.apt-search { position: relative; display: inline-block; }
.apt-search input { width: 220px; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font-family: inherit; font-size: 13px; }
.apt-search-pop { position: absolute; top: 36px; left: 0; z-index: 1200; min-width: 300px; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px; }
.apt-search-pop .it { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-family: inherit; }
.apt-search-pop .it:hover { background: var(--accent-soft); }
.apt-search-pop .it b { font-size: 13px; }
.apt-search-pop .it .sub { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.apt-search-pop .none { padding: 10px; color: var(--muted); font-size: 12.5px; }
@media (max-width: 860px) { .apt-search input { width: 160px; } }

select, input[type="number"] {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
select:focus, input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

#districtSelect { font-weight: 700; min-width: 96px; }
.num-input { width: 74px; }

button.primary {
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
button.primary:hover { background: #1d4fd7; }

.source-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fef0c7;
  color: #93370d;
  font-weight: 700;
  white-space: nowrap;
}
.source-badge.live { background: #d1fadf; color: #05603a; }

/* ===== 탭 ===== */
nav.tabs {
  display: flex;
  gap: 2px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 0 18px;
  /* 좁은 화면에서 탭이 줄바꿈되며 글자가 세로로 쪼개지지 않도록 가로 스크롤 */
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: thin;
}
nav.tabs::-webkit-scrollbar { height: 3px; }
nav.tabs::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
nav.tabs button {
  border: 0;
  background: none;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  font-family: inherit;
  white-space: nowrap;
  flex: none;
}
nav.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
nav.tabs button:hover { color: var(--text); }

main { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* 하단 고정 안내 — 지도 탭이 전체 높이를 쓰므로 얇게 유지한다 */
.site-footer {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 18px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}
.site-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.site-footer a:hover { text-decoration: underline; }
.tab-page { flex: 1; overflow: auto; display: none; }
.tab-page.active { display: flex; flex-direction: column; }

/* ===== 지도 탭 ===== */
#page-map { flex-direction: column; overflow: hidden; }

.stats-bar {
  display: flex;
  gap: 10px;
  padding: 10px 18px;
  overflow-x: auto;
  background: var(--bg);
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 16px;
  min-width: 118px;
  box-shadow: var(--shadow);
}
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-size: 16px; font-weight: 800; margin-top: 2px; letter-spacing: -.02em; }

.map-layout { flex: 1; display: flex; overflow: hidden; }

.map-wrap { flex: 1; min-width: 0; position: relative; }
#map { position: absolute; inset: 0; z-index: 1; }

/* 지도 필터 패널 (가격대·유형 토글) */
.map-filter {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 900;
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  box-shadow: var(--shadow);
  max-width: 230px;
  max-height: calc(100% - 20px);
  overflow-y: auto;
  backdrop-filter: blur(3px);
}
/* 넓은 화면에서는 항상 펼쳐 두고 토글 자체를 숨긴다 */
.mf-toggle { display: none; }
@media (max-width: 860px) {
  .map-filter { max-width: calc(100% - 20px); padding: 7px 10px; }
  .mf-toggle {
    display: block;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    list-style: none;
    user-select: none;
  }
  .mf-toggle::-webkit-details-marker { display: none; }
  .mf-toggle::after { content: " ▾"; color: var(--muted); }
  .map-filter[open] .mf-toggle::after { content: " ▴"; }
  .map-filter[open] .mf-body { margin-top: 8px; }
  .map-filter:not([open]) { padding: 6px 11px; }
}
.mf-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 11.5px; }
.mf-all {
  border: 1px solid var(--line); background: #fff; border-radius: 6px;
  font-size: 10.5px; padding: 1px 7px; cursor: pointer; color: var(--muted); font-family: inherit;
}
.mf-all:hover { border-color: var(--accent); color: var(--accent); }
.mf-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.mf-chip {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 8px; font-size: 10.5px; font-weight: 700;
  cursor: pointer; background: #fff; color: var(--muted);
  user-select: none; font-family: inherit;
}
.mf-chip .sw { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.mf-chip.on { color: #fff; border-color: transparent; }
.mf-chip.on .sw { background: rgba(255, 255, 255, .9); }
.mf-chip .n { opacity: .75; font-weight: 500; }
.mf-label { margin-top: 8px; font-size: 11.5px; color: var(--text); }
.mf-note { color: var(--muted); margin-top: 6px; font-size: 10.5px; line-height: 1.4; }

/* 매물 상세 패널 (마커 클릭) */
.detail-panel {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 950;
  width: 290px;
  max-height: calc(100% - 20px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(16, 24, 40, .18);
  padding: 14px 16px;
}
.detail-panel .dp-actions a.ext { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid #03c75a; color: #03c75a; font-weight: 700; font-size: 12.5px; text-decoration: none; }
.detail-panel .dp-actions a.ext:hover { background: #03c75a; color: #fff; }
.detail-panel .dp-note { margin-top: 8px; font-size: 11px; color: var(--muted); line-height: 1.45; }
.detail-panel .dp-close {
  position: absolute; top: 8px; right: 10px;
  border: 0; background: none; font-size: 17px; line-height: 1;
  color: var(--muted); cursor: pointer;
}
.detail-panel .dp-close:hover { color: var(--text); }
.dp-title { font-size: 15px; font-weight: 800; padding-right: 20px; }
.dp-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.dp-stat { display: flex; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.dp-stat div { font-size: 11px; color: var(--muted); }
.dp-stat b { display: block; font-size: 14px; color: var(--text); margin-top: 1px; }
.dp-sec { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 10px; }
.dp-row {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 12px; padding: 5px 0; border-bottom: 1px solid #f0f2f5;
}
.dp-row .p { font-weight: 700; color: var(--up); white-space: nowrap; }
.dp-row .m { color: var(--muted); }
.dp-actions { display: flex; gap: 6px; margin-top: 10px; }
.dp-actions button {
  flex: 1; height: 30px; border-radius: 7px; font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: inherit; border: 1px solid var(--line); background: #fff;
}
.dp-actions .save.on { background: #fee4e2; border-color: #fecdca; color: #b42318; }

/* 카카오 CustomOverlay는 anchor로 위치를 잡으므로 Leaflet용 보정 transform을 끈다.
   안 끄면 마커가 실제 위치에서 절반쯤 어긋나 보인다. */
.ov-kakao .bubble,
.ov-kakao .st { transform: none; }
.ov-kakao .bubble::after { bottom: -5px; }

/* 클러스터 마커 — 글자가 원 밖으로 넘치지 않도록 nowrap + 여유 있는 지름 */
.cl-icon { background: transparent !important; border: 0 !important; }
.cl-icon .b {
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  border-radius: 50%;
  color: #fff; font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.03em;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .28);
  border: 2px solid rgba(255, 255, 255, .9);
  box-sizing: border-box;
}
.cl-icon .b small {
  font-weight: 600;
  opacity: .85;
  font-size: .78em;
  margin-top: 1px;
}

.trade-panel {
  width: 380px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.trade-panel .panel-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.trade-panel .panel-head small { color: var(--muted); font-weight: 500; }
#tradeList { flex: 1; overflow-y: auto; }

.trade-item {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer;
}
.trade-item:hover, .trade-item.hl { background: var(--accent-soft); }
.trade-item .row1 { display: flex; justify-content: space-between; gap: 8px; }
.trade-item .name { font-weight: 700; font-size: 13.5px; }
.trade-item .price { font-weight: 800; font-size: 14px; color: var(--up); white-space: nowrap; }
.trade-item .row2 { display: flex; justify-content: space-between; margin-top: 3px; font-size: 12px; color: var(--muted); }

.empty { padding: 30px; text-align: center; color: var(--muted); }

/* 전국 보기 시군구 순위 */
.region-item .row2 { gap: 10px; justify-content: flex-start; flex-wrap: wrap; }
.region-item .rt i { font-style: normal; color: #9aa4b2; font-size: 11px; }
.region-item .rank {
  display: inline-block;
  min-width: 22px;
  margin-right: 6px;
  padding: 1px 5px;
  border-radius: 5px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.trade-item .row3 {
  margin-top: 3px;
  font-size: 11.5px;
  color: #175cd3;
  background: #eff6ff;
  border-radius: 5px;
  padding: 2px 7px;
  display: inline-block;
}
.trade-item .row3 b { font-weight: 800; }

.stat.jeonse { background: #f0f9ff; border-color: #bae6fd; }

.jeonse-src { font-weight: 500; color: var(--muted); font-size: 10.5px; }
.jeonse-box {
  border-radius: 8px;
  padding: 8px 11px;
  margin-top: 5px;
  border: 1px solid var(--line);
  background: #f8fafc;
}
.jeonse-box.high { background: #eff6ff; border-color: #bfdbfe; }
.jeonse-box.warn { background: #fffbeb; border-color: #fde68a; }
.jeonse-box.low { background: #f8fafc; }
.jb-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 2px 0; }
.jb-row b { font-weight: 700; }
.jb-row b.gap { color: var(--up); }
.jb-note { font-size: 10.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }

/* 지도 가격 버블 마커 */
.price-bubble {
  background: transparent !important;
  border: 0 !important;
}
.price-bubble .bubble {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  white-space: nowrap;
  transform: translate(-50%, -100%);
  border: 1.5px solid rgba(255,255,255,.85);
  cursor: pointer;
}
.price-bubble .bubble small { font-weight: 500; font-size: 9.5px; opacity: .9; max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.price-bubble .bubble::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom: 0;
}
.b-1 .bubble { background: #059669; } .b-1 .bubble::after { border-top: 5px solid #059669; }
.b-2 .bubble { background: #2563eb; } .b-2 .bubble::after { border-top: 5px solid #2563eb; }
.b-3 .bubble { background: #d97706; } .b-3 .bubble::after { border-top: 5px solid #d97706; }
.b-4 .bubble { background: #dc2626; } .b-4 .bubble::after { border-top: 5px solid #dc2626; }
.b-5 .bubble { background: #7c3aed; } .b-5 .bubble::after { border-top: 5px solid #7c3aed; }


.leaflet-popup-content { font-family: inherit; font-size: 12.5px; margin: 10px 14px; }
.leaflet-popup-content b.apt { font-size: 14px; }
.pop-row { display: flex; justify-content: space-between; gap: 14px; padding: 2px 0; border-bottom: 1px dashed #eee; }
.pop-row .p { font-weight: 700; color: var(--up); }

/* ===== 동네 추천 탭 ===== */
#page-rec { flex-direction: column; overflow: hidden; }
.rec-layout { flex: 1; display: flex; overflow: hidden; }

.rec-side {
  width: 440px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.rec-search { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.search-row { display: flex; gap: 8px; }
.search-row input[type="text"] {
  flex: 1;
  height: 38px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
}
.search-row input:focus { border-color: var(--accent); outline: none; }
.search-row .primary { height: 38px; }

.chip-row .ex-chip {
  background: #f2f4f7;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid transparent;
}
.ex-chip:hover { background: var(--accent-soft); color: var(--accent); }

.cand-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 9px 12px;
  margin-top: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}
.cand-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.cand-item b { font-size: 13.5px; }
.cand-item .sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rec-filters { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
label.cb { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; cursor: pointer; user-select: none; }
label.cb input { accent-color: var(--accent); }

#recResults { flex: 1; overflow-y: auto; }

.area-head { padding: 12px 16px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.area-head h3 { font-size: 15px; }
.area-head .muted { font-size: 12px; }
.st-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.st-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 9px; font-size: 11.5px; font-weight: 600;
}
.line-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }

.excluded-note {
  margin: 10px 16px 0;
  background: #f9fafb;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 11.5px;
  color: var(--muted);
}

.band-sec { padding: 4px 0 8px; }
.band-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel);
  padding: 9px 16px 7px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px; font-weight: 800;
}
.band-head small { color: var(--muted); font-weight: 500; }

.rec-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 16px;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer;
}
.rec-item:hover, .rec-item.hl { background: var(--accent-soft); }
.type-badge {
  flex: none;
  border-radius: 6px;
  font-size: 10.5px; font-weight: 800;
  padding: 3px 6px;
  color: #fff;
  margin-top: 2px;
  width: 52px;
  text-align: center;
}
.tb-apt { background: #2563eb; }
.tb-mixed { background: #7c3aed; }
.tb-villa { background: #059669; }
.tb-house { background: #b45309; }
.rec-item .body { flex: 1; min-width: 0; }
.rec-item .r1 { display: flex; justify-content: space-between; gap: 8px; }
.rec-item .name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-item .price { font-weight: 800; color: var(--up); white-space: nowrap; }
.rec-item .r2 { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.rec-item .station { font-size: 11.5px; margin-top: 3px; color: #175cd3; font-weight: 600; }
.rec-item .station.far { color: var(--muted); font-weight: 500; }

#recMap { flex: 1; min-width: 0; z-index: 1; }

/* 추천 지도 마커 */
.rec-bubble { background: transparent !important; border: 0 !important; }
.rec-bubble .bubble {
  display: inline-flex; flex-direction: column; align-items: center;
  color: #fff; border-radius: 9px; padding: 3px 8px;
  font-size: 10.5px; font-weight: 700; line-height: 1.25;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  white-space: nowrap;
  transform: translate(-50%, -100%);
  border: 1.5px solid rgba(255,255,255,.85);
}
.rec-bubble .bubble small { font-weight: 500; font-size: 9px; opacity: .92; max-width: 86px; overflow: hidden; text-overflow: ellipsis; }
.rb-apt .bubble { background: #2563eb; }
.rb-mixed .bubble { background: #7c3aed; }
.rb-villa .bubble { background: #059669; }
.rb-house .bubble { background: #b45309; }

.station-marker { background: transparent !important; border: 0 !important; }
.station-marker .st {
  display: inline-flex; align-items: center; gap: 4px;
  background: #1d2733; color: #fff;
  border-radius: 999px; padding: 2px 8px 2px 5px;
  font-size: 10.5px; font-weight: 700;
  box-shadow: 0 2px 5px rgba(0,0,0,.3);
  transform: translate(-50%, -50%);
  white-space: nowrap;
  border: 1.5px solid #fff;
}

@media (max-width: 860px) {
  .rec-layout { flex-direction: column-reverse; }
  .rec-side { width: 100%; height: 55%; border-right: 0; border-top: 1px solid var(--line); }
}

/* ===== 공통 콘텐츠 페이지 ===== */
.content-wrap { max-width: 1100px; margin: 0 auto; padding: 20px 18px 40px; width: 100%; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.card h2 { font-size: 17px; letter-spacing: -.02em; margin-bottom: 8px; }
.card h3 { font-size: 14px; margin-bottom: 6px; }
.card .muted { color: var(--muted); font-size: 12.5px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
}

.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.pros-cons .box { border-radius: 10px; padding: 13px 15px; }
.pros-cons .pros { background: #ecfdf3; border: 1px solid #abefc6; }
.pros-cons .cons { background: #fef3f2; border: 1px solid #fecdca; }
.pros-cons h3 { font-size: 13.5px; }
.pros-cons .pros h3 { color: var(--good); }
.pros-cons .cons h3 { color: var(--bad); }
.pros-cons ul { margin: 6px 0 0 17px; }
.pros-cons li { margin: 5px 0; line-height: 1.5; font-size: 13px; }

.nb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.nb-mini {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s, transform .15s;
}
.nb-mini:hover { border-color: var(--accent); transform: translateY(-1px); }
.nb-mini b { font-size: 14px; }
.nb-mini p { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.nb-mini.sel { border-color: var(--accent); background: var(--accent-soft); }

/* ===== 뉴스 탭 ===== */
.signal-card { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.signal-badge {
  font-size: 19px;
  font-weight: 800;
  padding: 12px 22px;
  border-radius: 12px;
  white-space: nowrap;
}
.sig-strong_up { background: #fee4e2; color: #b42318; }
.sig-up { background: #ffece8; color: #c4320a; }
.sig-neutral { background: #f2f4f7; color: #475467; }
.sig-down { background: #e0eaff; color: #1d4fd7; }
.sig-strong_down { background: #d6e4ff; color: #1743a8; }
.sig-no_data { background: #f2f4f7; color: #667085; }

.signal-meta { flex: 1; min-width: 240px; }
.signal-meta .bar {
  height: 10px;
  border-radius: 999px;
  background: #eef1f5;
  overflow: hidden;
  display: flex;
  margin: 8px 0 6px;
}
.signal-meta .bar i { display: block; height: 100%; }
.signal-meta .bar .p { background: #f97066; }
.signal-meta .bar .n { background: #98a2b3; }
.signal-meta .bar .m { background: #528bff; }
.legend-mini { font-size: 11.5px; color: var(--muted); display: flex; gap: 12px; }
.legend-mini i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; }

.news-item {
  display: block;
  padding: 11px 4px;
  border-bottom: 1px solid #f0f2f5;
  text-decoration: none;
  color: inherit;
}
.news-item:hover .title { color: var(--accent); text-decoration: underline; }
.news-item .title { font-size: 13.5px; font-weight: 600; line-height: 1.45; }
.news-item .meta { margin-top: 4px; font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag { border-radius: 5px; padding: 1.5px 7px; font-size: 10.5px; font-weight: 700; }
.tag.pos { background: #fee4e2; color: #b42318; }
.tag.neg { background: #e0eaff; color: #1d4fd7; }
.tag.neu { background: #f2f4f7; color: #667085; }
.tag.kw { background: #fffaeb; color: #93370d; font-weight: 600; }

/* ===== 규제 탭 ===== */
.reg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.reg-item { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: #fff; }
.reg-item h3 { color: var(--accent); font-size: 13.5px; }
.reg-item p { font-size: 12.5px; line-height: 1.6; margin-top: 6px; color: #344054; }
.reg-group { border-top: 1px solid var(--line); padding: 10px 0; }
.reg-group:first-of-type { border-top: 0; }
.reg-group > summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.reg-group > summary::-webkit-details-marker { display: none; }
.reg-group > summary::after { content: "▾"; color: var(--muted); font-size: 11px; margin-left: auto; }
.reg-group[open] > summary::after { content: "▴"; }
.reg-group > summary:hover { color: var(--accent); }
.rg-count {
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700;
}

.reg-meta { font-size: 10.5px; color: var(--muted); margin-top: 7px; padding-top: 6px; border-top: 1px dashed var(--line); }
.reg-meta a { color: var(--accent); }

.zone-chips .chip { background: #fef0c7; color: #93370d; }
.zone-chips .chip.ok { background: #d1fadf; color: #05603a; }
.warn-list { margin: 8px 0 0 17px; }
.warn-list li { font-size: 13px; line-height: 1.55; margin: 5px 0; }

/* ===== 자금 계획 / 갈아타기 ===== */
.fin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 12px;
  align-items: flex-start;
}
.fin-form > label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.fin-form input[type="number"], .fin-form select { width: 130px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-family: inherit; }
.fin-form label.cb { flex-direction: row; align-items: center; color: var(--text); font-size: 13px; }

.fav-btn {
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
  color: #98a2b3;
  flex: none;
}
.fav-btn.on { color: #e11d48; }
.fav-btn:hover { transform: scale(1.15); }

/* 자금 계획 — 대출 정보 */
.pl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; margin-top: 10px; }
.pl-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; font-size: 12.5px; line-height: 1.55; }
.pl-item h3 { font-size: 14px; margin: 0 0 4px; }
.pl-item .k { color: var(--muted); font-weight: 600; margin-top: 6px; font-size: 11.5px; }
.pl-item ul { margin: 2px 0 0 16px; padding: 0; }
.pl-item a { font-size: 12px; }
.br-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.br-tools .seg button { height: 30px; padding: 0 10px; border: 1px solid var(--line); background: #fff; border-radius: 7px; font-family: inherit; font-size: 12.5px; cursor: pointer; }
.br-tools .seg button.on { background: #334155; color: #fff; border-color: #334155; }
.br-wrap { overflow-x: auto; }
.br-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 720px; }
.br-table th, .br-table td { padding: 6px 8px; border-bottom: 1px solid #eef1f5; text-align: left; white-space: nowrap; }
.br-table th { color: var(--muted); font-weight: 600; cursor: pointer; user-select: none; background: #f8fafc; position: sticky; top: 0; }
.br-table th.sorted { color: var(--text); }
.br-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.br-note { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-top: 8px; }
.br-source { font-size: 11.5px; color: #475467; margin-top: 4px; }

/* 자금 계획 — 프로필만으로 나오는 요약 카드 */
.loading .elapsed { color: var(--muted); font-size: 12px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.cap-card { margin-top: 12px; border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 10px; padding: 12px 14px; }
.cap-card.empty-cap { background: #f8fafc; border-color: var(--line); color: var(--muted); font-size: 12.5px; }
.cap-main { display: flex; flex-direction: column; gap: 2px; }
.cap-k { font-size: 12px; color: var(--muted); font-weight: 600; }
.cap-v { font-size: 24px; font-weight: 800; color: var(--up); line-height: 1.2; }
.cap-sub { font-size: 12px; color: #475467; }
.cap-grid { margin-top: 8px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4px 14px; font-size: 12.5px; }
.cap-grid .r { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed #dbeafe; padding: 3px 0; }
.cap-grid .r b { font-weight: 700; }

.fin-item { border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; margin-top: 10px; }
.fin-item .head { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.fin-item .head .name { font-weight: 700; font-size: 14px; }
.fin-item .head .price { font-weight: 800; font-size: 15px; }
.afford-badge { border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.afford-yes { background: #d1fadf; color: #05603a; }
.afford-no { background: #fee4e2; color: #b42318; }
.fin-rows { margin-top: 9px; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 6px 14px; font-size: 12.5px; }
.fin-rows .r { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed #eef1f5; padding: 3px 0; }
.fin-rows .r b { font-weight: 700; }
.fin-notes { margin: 8px 0 0 16px; font-size: 12px; color: #475467; }
.fin-notes li { margin: 3px 0; line-height: 1.5; }
.rm-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline; }
.rm-btn:hover { color: var(--bad); }
.limit-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.limit-chip { font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; color: var(--muted); }
.limit-chip.binding { border-color: var(--accent); color: var(--accent); font-weight: 700; }

.lad-entry { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 12px; }
.lad-entry h3 { font-size: 15px; }
.momtech-badge { background: #fef0c7; color: #93370d; border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 800; }
.lad-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12.5px; }
.lad-table th { text-align: left; color: var(--muted); font-size: 11.5px; border-bottom: 1px solid var(--line); padding: 6px 8px; }
.lad-table td { border-bottom: 1px solid #f0f2f5; padding: 7px 8px; vertical-align: top; }
.lad-table .eq { font-weight: 800; }
/* 저평가 발굴 */
.under-score {
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  color: #fff; border-radius: 999px; padding: 3px 12px;
  font-size: 12px; font-weight: 800; white-space: nowrap;
}
.score-bar { height: 5px; background: #eef1f5; border-radius: 999px; margin-top: 8px; overflow: hidden; }
.score-bar i { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #7c3aed); }
.under-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px 14px;
  margin-top: 11px;
}
.under-stats div span { display: block; font-size: 11px; color: var(--muted); }
.under-stats div b { font-size: 14px; }
.under-stats b.cheap { color: var(--good); }
.under-stats b.rich { color: var(--muted); }

.reach-chip { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 2px 8px; font-size: 11.5px; font-weight: 700; margin: 2px 3px 0 0; }
.reach-none { color: var(--muted); font-size: 12px; }
.scenario-conservative { color: #475467; } .scenario-base { color: #b45309; } .scenario-optimistic { color: #b42318; }

.watch-link {
  display: block;
  font-size: 12.5px;
  line-height: 1.5;
  margin-top: 7px;
  color: var(--text);
  text-decoration: none;
}
.watch-link:hover { color: var(--accent); text-decoration: underline; }

.insight-link { color: var(--text); text-decoration: none; font-size: 13px; }
.insight-link:hover { color: var(--accent); text-decoration: underline; }

.glossary dt { font-weight: 700; font-size: 13px; margin-top: 10px; color: var(--accent); }
.glossary dd { font-size: 12.5px; color: #344054; margin: 2px 0 0; line-height: 1.55; }

.notice {
  background: #fffaeb;
  border: 1px solid #fedf89;
  color: #93370d;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  line-height: 1.55;
  margin-bottom: 14px;
}

.loading { padding: 34px; text-align: center; color: var(--muted); }
.spin {
  display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-right: 8px;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .map-layout { flex-direction: column; }
  .map-wrap { flex: 1 1 auto; min-height: 300px; }
  .trade-panel { width: 100%; flex: 0 0 42%; border-left: 0; border-top: 1px solid var(--line); }
  .pros-cons { grid-template-columns: 1fr; }
  .stats-bar { padding: 8px 12px; gap: 8px; }
  .stat { min-width: 96px; padding: 6px 12px; }
  .stat .v { font-size: 14px; }
  header { padding: 8px 12px; gap: 8px; }
  nav.tabs { padding: 0 12px; }
  nav.tabs button { padding: 10px 12px; font-size: 13px; }
  .detail-panel { width: calc(100% - 20px); max-width: 320px; }
  .content-wrap { padding: 14px 12px 32px; }
  .site-footer { padding: 5px 12px; font-size: 10.5px; gap: 6px; }
}
