:root {
  --ink: #17231d;
  --muted: #657169;
  --paper: #f5f3ed;
  --card: #fffef9;
  --line: #dddcd3;
  --green: #164f3b;
  --green-2: #25725a;
  --lime: #dce9a7;
  --orange: #d76d3b;
  --shadow: 0 16px 42px rgba(23, 35, 29, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
a { color: inherit; }

.topbar {
  height: 72px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 35, 29, .12);
  background: rgba(245, 243, 237, .92);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--green); color: white;
  font-family: Georgia, serif; font-style: italic; font-size: 22px;
}
.brand strong, .brand span { display: block; }
.brand strong { font-family: Georgia, serif; font-size: 19px; letter-spacing: .02em; }
.brand span { color: var(--muted); font-size: 11px; margin-top: 2px; text-transform: uppercase; letter-spacing: .1em; }
.topbar-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #5f9f49; box-shadow: 0 0 0 4px rgba(95,159,73,.13); }

main { padding: 0 clamp(16px, 4vw, 64px) 56px; }
.hero {
  padding: 54px 0 36px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr);
  align-items: end;
  gap: 40px;
}
.eyebrow { margin: 0 0 12px; color: var(--orange); font-size: 11px; letter-spacing: .2em; font-weight: 800; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(42px, 5.5vw, 76px); line-height: .98; letter-spacing: -.045em; font-weight: 500; }
h1 em { color: var(--green-2); font-weight: 400; }
.hero-copy { max-width: 660px; color: var(--muted); font-size: 15px; line-height: 1.65; margin: 22px 0 0; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); padding-top: 20px; }
.hero-stats div { padding: 0 16px; border-left: 1px solid var(--line); }
.hero-stats div:first-child { border-left: 0; padding-left: 0; }
.hero-stats strong { display: block; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.hero-stats span { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; margin-top: 3px; }

.filter-shell { background: var(--green); color: white; border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.search-box { height: 48px; background: white; border-radius: 10px; display: flex; align-items: center; color: var(--ink); margin-bottom: 14px; }
.search-box span { font-size: 26px; padding: 0 12px 2px 17px; color: var(--green-2); }
.search-box input { border: 0; outline: 0; width: 100%; height: 100%; background: transparent; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
.filters label { color: rgba(255,255,255,.68); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.filters select { margin-top: 6px; width: 100%; height: 40px; border: 1px solid rgba(255,255,255,.22); color: white; background: rgba(255,255,255,.08); border-radius: 8px; padding: 0 9px; outline: none; text-transform: none; letter-spacing: normal; font-size: 12px; }
.filters select option { color: var(--ink); background: white; }
.filter-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 13px; }
.filter-actions span { color: rgba(255,255,255,.58); font-size: 10px; }
.btn-secondary { border: 1px solid rgba(255,255,255,.3); background: transparent; color: white; border-radius: 99px; padding: 7px 14px; cursor: pointer; font-size: 11px; }
.btn-secondary:hover { background: white; color: var(--green); }

.workspace { display: grid; grid-template-columns: minmax(430px, .95fr) minmax(460px, 1.05fr); gap: 18px; margin-top: 20px; min-height: 720px; }
.list-pane { min-width: 0; }
.results-head { display: flex; justify-content: space-between; align-items: center; height: 48px; }
.results-head strong { font-family: Georgia, serif; font-size: 21px; }
.results-head span { color: var(--muted); font-size: 11px; }
.legend { display: flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); border: 1px solid var(--green-2); }
.cards { display: grid; gap: 12px; }

.property-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  grid-template-columns: 152px minmax(0, 1fr);
  gap: 16px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.property-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c4c8bc; }
.image-placeholder {
  min-height: 142px; border-radius: 10px; overflow: hidden; position: relative;
  background: linear-gradient(145deg, #d9ddd2 0%, #b7c6b8 45%, #788f7f 100%);
}
.image-placeholder::before { content: ""; position: absolute; left: 17px; right: 17px; bottom: 20px; height: 62px; clip-path: polygon(0 100%, 0 42%, 19% 42%, 19% 25%, 48% 25%, 48% 0, 80% 28%, 100% 28%, 100% 100%); background: rgba(255,255,255,.53); }
.image-placeholder::after { content: "Ảnh từ nguồn"; position: absolute; left: 10px; top: 10px; background: rgba(23,35,29,.72); color: white; border-radius: 99px; padding: 5px 8px; font-size: 9px; }
.card-main { min-width: 0; display: flex; flex-direction: column; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-title { font-family: Georgia, serif; font-size: 18px; line-height: 1.25; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.status-pill { white-space: nowrap; border-radius: 99px; background: #eef1e9; color: #59655d; padding: 5px 8px; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.status-pill.stale { background: #f5ddd1; color: #944723; }
.location { color: var(--muted); font-size: 11px; margin-top: 7px; }
.specs { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.specs span { font-size: 11px; font-weight: 650; }
.specs small { color: var(--muted); font-weight: 400; }
.card-bottom { margin-top: auto; border-top: 1px solid #ecebe4; padding-top: 11px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.price strong { display: block; font-family: Georgia, serif; font-size: 20px; font-weight: 500; color: var(--green); }
.price span { color: var(--muted); font-size: 9px; }
.source-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.source-tag { text-decoration: none; border: 1px solid #b9c6b9; color: var(--green); background: #f5f8ee; padding: 6px 8px; border-radius: 6px; font-size: 9px; font-weight: 750; transition: .15s ease; }
.source-tag:hover { background: var(--lime); border-color: var(--green-2); }
.source-tag::after { content: " ↗"; }
.source-tag.cheapest, .popup-source-link.cheapest { background: var(--lime); border-color: var(--green-2); box-shadow: inset 0 0 0 1px var(--green-2); }
.quality-flags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.quality-flag { color: #7c604f; background: #f3ebe2; border-radius: 4px; padding: 3px 5px; font-size: 8px; }

.map-pane { position: sticky; top: 92px; height: calc(100vh - 112px); min-height: 620px; border-radius: 15px; overflow: hidden; border: 1px solid var(--line); background: #dfe6dc; }
#map { height: 100%; width: 100%; }
.map-caption { position: absolute; left: 14px; bottom: 14px; z-index: 600; background: rgba(255,254,249,.92); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-size: 9px; color: var(--muted); box-shadow: 0 5px 20px rgba(23,35,29,.1); display: grid; gap: 5px; }
.map-caption strong { color: var(--ink); font-size: 10px; }
.map-caption span { display: block; }
.map-legend { display: flex !important; align-items: center; gap: 5px; }
.map-region-note { max-width: 240px; line-height: 1.35; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-dot.exact { background: var(--green); }
.legend-dot.approximate { background: var(--orange); margin-left: 5px; }
.custom-marker { position: absolute; left: calc(var(--pin, 28px) / -2); top: calc(var(--pin, 28px) * -1); width: var(--pin, 28px); height: var(--pin, 28px); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--green); border: calc(var(--pin, 28px) * .1) solid white; box-shadow: 0 2px 8px rgba(23,35,29,.3); }
.custom-marker.approximate { background: var(--orange); opacity: .84; }
.custom-marker.exact { background: var(--green); }
.leaflet-popup-content-wrapper { border-radius: 10px; }
.popup-title { font: 600 14px/1.25 Georgia, serif; margin-bottom: 9px; }
.popup-price { color: var(--green); font-weight: 750; }
.popup-note { color: var(--muted); font-size: 10px; margin-top: 4px; }
.popup-facts { display: grid; grid-template-columns: 1fr 1fr 1fr; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; margin-bottom: 7px; }
.popup-fact { padding: 6px 7px; border-right: 1px solid var(--line); background: #fffef9; }
.popup-fact:nth-child(4) { border-right: 0; }
.popup-fact-price { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line); background: #edf4e9; }
.popup-fact span { display: block; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.popup-fact strong { color: var(--ink); font-size: 11px; }
.popup-fact-price strong { color: var(--green); font-size: 13px; }
.popup-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.popup-source-link, .popup-map-link, .map-link { color: var(--green); display: inline-block; font-size: 10px; font-weight: 750; text-decoration: none; border: 1px solid rgba(22,79,59,.25); border-radius: 999px; padding: 5px 8px; background: #f8fbf5; }
.popup-source-link { background: var(--green); color: white; border-color: var(--green); }
.popup-source-link:hover { background: var(--green-2); }
.popup-map-link:hover, .map-link:hover { border-color: var(--green); }
.popup-no-source { color: var(--muted); font-size: 10px; }
.map-unavailable { display: inline-block; color: var(--muted); font-size: 10px; margin-top: 9px; }

.mobile-tabs { display: none; }
.empty { min-height: 280px; display: grid; place-content: center; text-align: center; gap: 6px; color: var(--muted); }
.empty strong { color: var(--ink); font-family: Georgia, serif; font-size: 22px; }

#detail-dialog { width: min(760px, calc(100vw - 28px)); border: 0; border-radius: 18px; padding: 0; background: var(--card); color: var(--ink); box-shadow: 0 30px 90px rgba(23,35,29,.3); }
#detail-dialog::backdrop { background: rgba(15,25,20,.58); backdrop-filter: blur(4px); }
.dialog-close { position: absolute; right: 15px; top: 13px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 23px; cursor: pointer; z-index: 2; }
.detail-hero { padding: 36px; background: linear-gradient(135deg, #dce4d8, #b6c8ba); }
.detail-hero .eyebrow { margin-bottom: 9px; }
.detail-hero h2 { margin: 0; max-width: 620px; font-family: Georgia, serif; font-weight: 500; font-size: 34px; line-height: 1.08; }
.detail-body { padding: 26px 36px 36px; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 22px; }
.detail-stat { padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.detail-stat strong, .detail-stat span { display: block; }
.detail-stat strong { font-family: Georgia, serif; font-size: 18px; }
.detail-stat span { color: var(--muted); font-size: 9px; margin-top: 3px; }
.detail-section { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.detail-section h3 { margin: 0 0 10px; font: 600 15px Georgia, serif; }
.detail-section p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.source-row { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 12px 0; border-bottom: 1px solid #ecebe4; }
.source-row:last-child { border-bottom: 0; }
.source-row strong, .source-row span { display: block; }
.source-row span { color: var(--muted); font-size: 9px; margin-top: 3px; }
.notice { background: #f5eee3; border-left: 3px solid var(--orange); padding: 12px 14px; color: #76513e !important; }

footer { min-height: 72px; padding: 0 clamp(20px, 4vw, 64px); border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 10px; }

@media (max-width: 1180px) {
  .filters { grid-template-columns: repeat(4, 1fr); }
  .workspace { grid-template-columns: minmax(400px, .9fr) minmax(400px, 1.1fr); }
}
@media (max-width: 820px) {
  .topbar-meta { display: none; }
  main { padding-inline: 12px; }
  .hero { grid-template-columns: 1fr; padding-top: 34px; }
  .hero-stats { max-width: 520px; }
  .filters { grid-template-columns: repeat(2, 1fr); }
  .filter-actions span { display: none; }
  .mobile-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-top: 16px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
  .mobile-tabs button { border: 0; padding: 11px; background: var(--card); color: var(--muted); }
  .mobile-tabs button.active { background: var(--green); color: white; }
  .workspace { display: block; margin-top: 6px; min-height: 0; }
  .map-pane { display: none; position: relative; top: 0; height: 68vh; min-height: 460px; }
  .workspace.show-map .list-pane { display: none; }
  .workspace.show-map .map-pane { display: block; }
  .property-card { grid-template-columns: 118px 1fr; }
  .image-placeholder { min-height: 145px; }
  .card-bottom { align-items: flex-start; flex-direction: column; }
  .source-tags { justify-content: flex-start; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 5px; }
}
@media (max-width: 520px) {
  h1 { font-size: 43px; }
  .hero-stats strong { font-size: 28px; }
  .property-card { grid-template-columns: 1fr; }
  .image-placeholder { min-height: 160px; }
  .detail-hero, .detail-body { padding-left: 20px; padding-right: 20px; }
  .detail-hero h2 { font-size: 27px; }
}

/* Ảnh trên thẻ, popup, chi tiết */
.card-photo { position: relative; min-height: 142px; border-radius: 10px; overflow: hidden; background: #cfd6ca; }
.card-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-count { position: absolute; left: 8px; top: 8px; background: rgba(23,35,29,.72); color: #fff; border-radius: 99px; padding: 4px 8px; font-size: 9px; }
.popup-photo { display: block; width: 100%; height: 130px; object-fit: cover; border-radius: 8px; margin: 2px 0 8px; }
.gallery { display: flex; gap: 6px; overflow-x: auto; padding: 0 36px 6px; background: linear-gradient(135deg, #dce4d8, #b6c8ba); scroll-snap-type: x proximity; }
.gallery a { flex: 0 0 auto; scroll-snap-align: start; }
.gallery img { display: block; height: 220px; width: auto; max-width: 420px; object-fit: cover; border-radius: 8px; }
.detail-hero + .gallery { margin-top: -1px; }
@media (max-width: 520px) { .card-photo { min-height: 160px; } .gallery { padding: 0 20px 6px; } .gallery img { height: 170px; } }

/* Bản đồ toàn màn hình (chỉ xem bản đồ) */
.map-btn { position: absolute; z-index: 700; top: 12px; left: 12px; border: 1px solid var(--line); background: rgba(255,254,249,.95); color: var(--ink); border-radius: 8px; padding: 8px 11px; font-size: 11px; font-weight: 700; cursor: pointer; box-shadow: 0 5px 20px rgba(23,35,29,.12); }
.map-btn:hover { background: var(--lime); }
.map-close { display: none; }
body.map-full { overflow: hidden; }
body.map-full .map-pane { position: fixed; inset: 0; top: 0; height: 100vh; min-height: 0; max-height: none; z-index: 3000; border-radius: 0; border: 0; display: block; }
body.map-full .map-expand { display: none; }
body.map-full .map-close { display: block; }
body.map-full .map-caption { font-size: 11px; }
.leaflet-container a.popup-source-link { color: #fff; }
.leaflet-container a.popup-source-link.cheapest { color: var(--green); }

/* Đã xem: xám */
:root { --viewed: #8b9490; --viewed-soft: #e9ecea; --viewed-ink: #505a55; }
.legend-dot.viewed { background: var(--viewed); margin-left: 5px; }
.custom-marker.viewed { background: var(--viewed); opacity: 1; }
.source-tag.viewed { background: var(--viewed-soft); border-color: var(--viewed); color: var(--viewed-ink); box-shadow: none; }
.source-tag.viewed:hover { background: var(--viewed); color: #fff; }
.leaflet-container a.popup-source-link.viewed { background: var(--viewed); border-color: var(--viewed); color: #fff; box-shadow: none; }
.property-card.is-viewed { border-color: #c5ccc7; }
.quality-flag.viewed-flag { background: var(--viewed-soft); color: var(--viewed-ink); border-color: var(--viewed); }

.save-status { font-size: 9px; padding: 3px 7px; border-radius: 99px; margin-left: 10px; }
.save-status.ok { color: #2a6b4d; background: #e7f1e3; }
.save-status.warn { color: #8f4a05; background: #fde6cc; cursor: help; }
.results-head { flex-wrap: wrap; gap: 6px; }
.results-head { height: auto; min-height: 48px; }

/* Nút trượt ảnh trên thẻ */
.photo-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(23,35,29,.6); color: #fff; font-size: 20px; line-height: 26px; padding: 0 0 2px; cursor: pointer; opacity: .9; transition: background .15s, opacity .15s; }
.photo-nav:hover, .photo-nav:focus-visible { background: rgba(23,35,29,.88); opacity: 1; }
.photo-nav.prev { left: 6px; }
.photo-nav.next { right: 6px; }
.photo-count b { font-weight: 700; }

.popup-photo-box { height: 150px; min-height: 0; margin: 2px 0 8px; }
.popup-photo-box .photo-nav { width: 30px; height: 30px; }

/* Tym / Ẩn */
.item-actions { display: flex; gap: 6px; margin-top: 9px; }
.act { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 99px; padding: 5px 10px; font-size: 10px; font-weight: 700; cursor: pointer; transition: .15s ease; }
.act:hover { background: #f1f3ec; }
.act.fav.on { background: #ffe3ec; border-color: #e0457b; color: #b3204f; }
.act.hide.on { background: var(--lime); border-color: var(--green-2); color: var(--green); }
.property-card.is-fav { border-color: #f0a5bf; }
.custom-marker.fav { box-shadow: 0 0 0 3px #e0457b, 0 3px 10px rgba(23,35,29,.3); }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 4000; display: flex; align-items: center; gap: 14px; max-width: min(560px, 92vw); background: rgba(23,35,29,.95); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.toast[hidden] { display: none; }
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button { border: 0; background: var(--lime); color: var(--green); border-radius: 99px; padding: 5px 12px; font-weight: 800; font-size: 11px; cursor: pointer; flex: none; }
.legend-dot.fav { background: #e0457b; margin-left: 5px; }

/* Ngày đăng + nhãn tin đã gỡ (thêm 21/10/2026) */
.card-pills { display: inline-flex; gap: 5px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.removed-badge { white-space: nowrap; border-radius: 99px; background: #f6d6cf; color: #9a2f1c; border: 1px solid #e3a99b; padding: 4px 8px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; }
.detail-hero .removed-badge { display: inline-block; margin-top: 10px; }
/* NEW = đăng trong 5 ngày gần đây; viền cam = căn mới của lượt cào mà người đang dùng chưa xem (meta.js) — 22/10/2026 */
.new-badge { white-space: nowrap; border-radius: 99px; background: #b4501f; color: #fff; padding: 4px 8px; font-size: 9px; font-weight: 800; letter-spacing: .06em; vertical-align: middle; }
.property-card.is-fresh { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange); }
/* Tài khoản xem (Huy · Hannah · Hieu): lịch sử xem tách theo người, Tym/Ẩn dùng chung */
.who-toggle { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; margin-right: 12px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--green); font-size: 13px; cursor: pointer; }
.who-toggle:hover { background: var(--lime); }
#who-dialog { width: min(360px, calc(100vw - 32px)); border: 0; border-radius: 18px; padding: 24px; background: var(--card); color: var(--ink); box-shadow: 0 30px 90px rgba(23,35,29,.3); }
#who-dialog::backdrop { background: rgba(15,25,20,.58); backdrop-filter: blur(4px); }
#who-dialog h2 { font-family: Georgia, serif; font-size: 22px; margin: 0 0 6px; }
#who-dialog p { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.who-choices { display: grid; gap: 8px; }
.who-choices button { min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font-size: 16px; font-weight: 700; cursor: pointer; }
.who-choices button:hover, .who-choices button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
@media (max-width: 820px) { .who-toggle { margin: 0 0 0 6px; padding: 0 9px; } }
.posted-line { color: var(--green-2); font-size: 11px; margin-top: 5px; font-weight: 650; }
.posted-line.detail { font-size: 14px; margin: 0; }
.posted-extra { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.popup-posted { color: var(--green-2); font-size: 11px; font-weight: 650; margin: -2px 0 8px; }

/* So sánh giá các link trùng (22/10/2026) */
.compare-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.compare-table th { text-align: left; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; padding: 4px 8px; border-bottom: 1px solid #e3e0d4; }
.compare-table td { padding: 8px; border-bottom: 1px solid #efece2; vertical-align: middle; }
.compare-table .gap { display: block; color: #9a2f1c; font-weight: 700; font-size: 11px; }
.compare-table .gap.low { color: var(--green-2); }

/* Popup bản đồ: đủ link trùng (22/10/2026) */
.popup-compare { margin-top: 10px; border-top: 1px solid #e3e0d4; padding-top: 8px; max-height: 190px; overflow-y: auto; }
.popup-compare-head { font-size: 11px; font-weight: 800; color: var(--green-2); margin-bottom: 4px; }
.popup-compare-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #efece2; }
.popup-compare-row strong { font-size: 13px; }
.popup-compare-row span { display: block; color: var(--muted); font-size: 11px; line-height: 1.3; }
.popup-compare-row .gap { color: #9a2f1c; font-weight: 700; font-size: 11px; margin-left: 6px; }
.compare-table .basis, .popup-compare-row .basis { color: var(--muted); font-size: 11px; }

.property-card.is-removed { opacity: .72; }

/* Pin mốc tham chiếu (Chợ Hàn) */
.landmark-marker { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #d9a82b; border: 3px solid white; box-shadow: 0 3px 10px rgba(23,35,29,.35); display: grid; place-items: center; }
.landmark-marker span { transform: rotate(45deg); color: #fff; font-size: 14px; line-height: 1; }
.landmark-tag { display: inline-block; vertical-align: middle; border-radius: 99px; background: #f6ebc7; color: #7a5a06; border: 1px solid #e3cf8a; padding: 3px 7px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.legend-dot.landmark { background: #d9a82b; }

/* Đường tới Chợ Hàn */
.route-line { color: #7a5a06; font-size: 11px; font-weight: 700; margin-top: 4px; }
.popup-route { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: #fbf3d9; border: 1px solid #e3cf8a; }
.popup-route .route-line { margin: 0 0 6px; font-size: 12px; }
.popup-gmaps { color: var(--green); font-size: 11px; font-weight: 800; text-decoration: none; border-bottom: 1px solid currentColor; }

/* Cụm pin */
.vs-cluster { border-radius: 50%; background: var(--green); color: #fff; border: 3px solid #fff; box-shadow: 0 3px 12px rgba(23,35,29,.35); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.vs-cluster.fav { box-shadow: 0 0 0 3px #e0457b, 0 3px 12px rgba(23,35,29,.35); }
.leaflet-tooltip { font-size: 12px; font-weight: 700; color: var(--green); border-radius: 8px; }

/* Pin giá kiểu Airbnb (22/10/2026) */
.price-pin { position: absolute; left: 0; bottom: 7px; transform: translateX(-50%); white-space: nowrap; background: #fff; color: #17231d; border: 1px solid rgba(23,35,29,.18); border-radius: 999px; padding: 4px 9px; font: 800 12px/1.2 system-ui, sans-serif; box-shadow: 0 2px 8px rgba(23,35,29,.25); cursor: pointer; transition: transform .12s, background .12s; }
.price-pin::after { content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-bottom: 0; border-top-color: #fff; }
.price-pin.approximate { border-style: dashed; color: #8a4a26; }
.price-pin.viewed { background: #ecebe6; color: #6c706d; }
.price-pin.viewed::after { border-top-color: #ecebe6; }
.price-pin.fav { color: #b3204f; border-color: #e0457b; }
.price-pin.removed { text-decoration: line-through; opacity: .75; }
.price-pin.hover, .price-pin:hover { transform: translateX(-50%) scale(1.12); }
.price-pin.active, .price-pin.hover { background: var(--green); color: #fff; border-color: var(--green); }
.price-pin.active::after, .price-pin.hover::after { border-top-color: var(--green); }
.landmark-pin { position: absolute; left: 0; bottom: 4px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; white-space: nowrap; background: #d9a82b; color: #fff; border: 2px solid #fff; border-radius: 999px; padding: 3px 9px 3px 6px; font: 800 11px/1.2 system-ui, sans-serif; box-shadow: 0 2px 8px rgba(23,35,29,.3); cursor: pointer; }
.map-fit-btn { width: 34px; height: 34px; border-radius: 4px; border: 2px solid rgba(0,0,0,.2); background: #fff; font-size: 18px; cursor: pointer; }
.map-fit-btn:hover { background: #f4f4f4; }
.vs-cluster.hover { background: #0e3528; transform: scale(1.15); }
.vs-cluster { transition: transform .12s; }
.price-pin.stacked::after { display: none; }

/* ===== Điện thoại (22/10/2026) — tiêu chí ở qa/mobile-ux-checklist.md, chấm bằng qa/mobile-score.py ===== */
.filter-toggle, .filter-sheet-head, .map-filter { display: none; }
@media (max-width: 820px) {
  body.mobile-map .map-filter { display: inline-flex; align-items: center; gap: 6px; position: fixed; z-index: 1300; top: calc(12px + env(safe-area-inset-top)); right: 12px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 99px; background: var(--green); color: #fff; font-size: 15px; font-weight: 700; box-shadow: 0 6px 18px rgba(23,35,29,.3); }
  .map-filter .count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 99px; background: var(--lime); color: var(--green); font-size: 12px; padding: 0 6px; }
  .map-filter .count[hidden] { display: none; }
}
/* Máy tính: lọc vẫn tự áp dụng khi đổi ô; nút này báo số căn và cuộn xuống danh sách. */
.filter-actions { gap: 10px; }
.filter-apply { margin-right: auto; border: 0; border-radius: 99px; background: var(--lime); color: var(--green); padding: 7px 16px; font-size: 11px; font-weight: 800; cursor: pointer; }
@media (max-width: 820px) {
  html { -webkit-text-size-adjust: 100%; }
  body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  /* Nội dung trước: hero gọn để thẻ đầu lộ ra ngay màn đầu */
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
  .eyebrow, .hero-copy { display: none; }
  .hero { padding-top: 14px; gap: 10px; }
  h1 { font-size: 26px; line-height: 1.12; margin: 0; }
  .hero-stats { margin-top: 0; padding-top: 10px; }
  .hero-stats strong { font-size: 20px; }
  .hero-stats span { font-size: 12px; }
  /* Tìm kiếm + nút Bộ lọc; bộ lọc chi tiết là tấm trượt đáy màn */
  .filter-shell { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px; margin-top: 12px; }
  .search-box input { font-size: 16px; min-height: 46px; }
  .filter-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff; font-size: 15px; font-weight: 700; }
  .filter-toggle .count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 99px; background: var(--lime); color: var(--green); font-size: 12px; padding: 0 6px; }
  .filter-toggle .count[hidden] { display: none; }
  .filter-shell .filters, .filter-shell .filter-actions, .filter-shell .filter-sheet-head { display: none; }
  .filter-shell.open .filter-sheet-head { display: flex; justify-content: space-between; align-items: center; position: fixed; left: 0; right: 0; bottom: min(78vh, 640px); z-index: 2001; background: var(--green); color: #fff; padding: 12px 16px; border-radius: 18px 18px 0 0; font-size: 17px; }
  .filter-close { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 24px; }
  .filter-shell.open .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; position: fixed; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); max-height: calc(min(78vh, 640px) - 76px); overflow-y: auto; z-index: 2000; background: var(--green); padding: 8px 16px 16px; }
  .filter-shell.open .filter-actions { display: flex; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 2001; background: var(--green); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.15); }
  .filter-apply { display: block; flex: 1; min-height: 48px; border: 0; border-radius: 10px; background: var(--lime); color: var(--green); font-size: 16px; font-weight: 800; }
  .filter-actions .btn-secondary { min-height: 48px; font-size: 15px; padding: 0 16px; }
  body.sheet-open::after { content: ""; position: fixed; inset: 0; background: rgba(15,25,20,.5); z-index: 1999; }
  .filters label { font-size: 12px; }
  .filters select, .filters input { font-size: 16px; min-height: 48px; }
  /* Chuyển Danh sách / Bản đồ: nút nổi giữa đáy màn, trong tầm ngón cái */
  .mobile-tabs { position: fixed; z-index: 1500; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); width: min(300px, calc(100vw - 48px)); margin: 0; border: 0; border-radius: 99px; box-shadow: 0 8px 24px rgba(23,35,29,.3); }
  .mobile-tabs button { min-height: 48px; font-size: 15px; font-weight: 700; }
  body.sheet-open .mobile-tabs { display: none; }
  /* Bản đồ toàn màn khi chọn tab Bản đồ */
  body.mobile-map .workspace.show-map .map-pane { position: fixed; inset: 0; height: 100dvh; min-height: 0; z-index: 1200; border-radius: 0; margin: 0; }
  body.mobile-map .map-caption, body.mobile-map .map-expand, .map-expand { display: none; }
  .leaflet-control-zoom a, .map-fit-btn { width: 44px !important; height: 44px !important; line-height: 44px !important; font-size: 20px; }
  .leaflet-top { top: env(safe-area-inset-top); }
  .price-pin { font-size: 13px; padding: 6px 10px; }
  .landmark-pin { font-size: 12px; }
  /* Chữ tối thiểu 12 px, chữ chính ≥ 14 px */
  .brand span, .results-head span, .legend, .save-status, .location, .specs span, .specs small, .price span, .status-pill, .removed-badge, .new-badge, .quality-flag, .photo-count, .posted-line, .route-line,
  .popup-note, .popup-fact span, .popup-posted, .popup-no-source, .map-unavailable, .detail-stat span, .source-row span, footer, .compare-table th, .compare-table .gap,
  .popup-compare-head, .popup-compare-row span, .popup-compare-row .gap, .compare-table .basis, .landmark-tag, .popup-gmaps, .image-placeholder::after, .toast button, .eyebrow { font-size: 12px; }
  .specs span { font-size: 14px; }
  .popup-fact strong { font-size: 14px; }
  .card-title { font-size: 18px; }
  /* Vùng chạm ≥ 44 px */
  .photo-nav { width: 44px; height: 44px; font-size: 22px; }
  .act, .btn-secondary { min-height: 44px; padding: 0 14px; font-size: 14px; }
  .source-tag, .popup-source-link, .popup-map-link, .map-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; font-size: 13px; }
  .popup-gmaps { display: inline-flex; align-items: center; min-height: 44px; }
  .map-btn { min-height: 44px; font-size: 14px; }
  .leaflet-popup-close-button { width: 44px !important; height: 44px !important; font-size: 24px !important; line-height: 44px !important; }
  /* Chi tiết căn: toàn màn, nút đóng 44 px */
  #detail-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .dialog-close { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
}

.map-sheet[hidden] { display: none; }
@media (max-width: 820px) {
  .legend { display: none; }
  .leaflet-control-zoom { display: none; } /* điện thoại phóng to bằng hai ngón như Google Maps; giữ nút ⌖ */
  body.mobile-map .leaflet-popup { display: none; }
  .map-sheet { position: fixed; z-index: 1600; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); max-height: 62dvh; overflow-y: auto; background: var(--card); border-radius: 18px; padding: 14px 14px 16px; box-shadow: 0 -6px 30px rgba(23,35,29,.28); overscroll-behavior: contain; }
  .map-sheet .popup-photo-box { min-height: 150px; height: 150px; }
  .map-sheet-close { position: sticky; top: 0; float: right; z-index: 3; width: 44px; height: 44px; margin: -4px -4px 0 8px; border-radius: 50%; border: 0; background: rgba(23,35,29,.08); font-size: 24px; }
  .map-sheet .popup-title { font-size: 17px; }
  body.map-sheet-open .mobile-tabs { display: none; }
}
@media (max-width: 820px) {
  /* ghi công bản đồ lên góc trên trái để tấm thẻ đáy không đè */
  body.mobile-map .leaflet-bottom.leaflet-right { top: env(safe-area-inset-top); bottom: auto; left: 0; right: auto; }
  body.mobile-map .leaflet-control-attribution { font-size: 10px; border-radius: 0 0 8px 0; }
}
@media (max-width: 520px) { .card-photo { min-height: 150px; } }

/* Lọc nhanh */
.quick-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.quick-chips::-webkit-scrollbar { display: none; }
.quick-chips button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer; }
.quick-chips button b { font-weight: 800; color: var(--muted); font-size: 12px; }
.quick-chips button:empty b, .quick-chips b:empty { display: none; }
.quick-chips button.on { background: var(--green); border-color: var(--green); color: #fff; }
.quick-chips button.on b { color: var(--lime); }
.quick-chips button[data-mark="fav"].on { background: #c2185b; border-color: #c2185b; }
@media (max-width: 820px) { .quick-chips button { min-height: 44px; font-size: 14px; } }

.market-link { margin-left: auto; margin-right: 16px; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--green); font-weight: 700; font-size: 14px; text-decoration: none; }
.market-link:hover { background: var(--lime); }
@media (max-width: 820px) { .market-link { margin-right: 0; } }
/* Chọn ngôn ngữ: nút hiện ngôn ngữ đang dùng (VI ▾ / EN ▾), bấm mở menu Tiếng Việt · English. */
.lang-switch { position: relative; margin-right: 12px; }
.lang-toggle { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; min-width: 56px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--green); font-weight: 800; font-size: 13px; cursor: pointer; }
.lang-toggle span { font-size: 10px; opacity: .7; }
.lang-toggle:hover, .lang-switch.open .lang-toggle { background: var(--lime); }
.lang-menu { display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 3100; min-width: 150px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(23,35,29,.18); }
.lang-switch.open .lang-menu { display: block; }
.lang-menu button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: 14px; text-align: left; cursor: pointer; }
.lang-menu button:hover { background: var(--paper); }
.lang-menu button[aria-checked="true"] { color: var(--green); font-weight: 800; }
.lang-menu button[aria-checked="true"]::after { content: "✓"; }
@media (max-width: 820px) { .market-link { white-space: nowrap; padding: 0 10px; } .lang-switch { margin: 0 0 0 6px; } .lang-toggle { min-width: 52px; padding: 0 9px; } }
/* Bản sao nổi trên bản đồ: điện thoại (dưới nút Bộ lọc) + bản đồ toàn màn trên máy tính (cạnh nút phóng to). */
.lang-toggle-map { display: none; }
body.map-full .lang-toggle-map { display: block; position: absolute; z-index: 700; top: 10px; right: 56px; margin: 0; }
body.map-full .lang-toggle-map .lang-toggle { box-shadow: 0 5px 20px rgba(23,35,29,.12); }
@media (max-width: 820px) {
  body.mobile-map .lang-toggle-map { display: block; position: fixed; z-index: 1300; top: calc(64px + env(safe-area-inset-top)); right: 12px; margin: 0; }
  body.mobile-map .lang-toggle-map .lang-toggle { background: var(--green); color: #fff; border: 0; box-shadow: 0 6px 18px rgba(23,35,29,.3); }
  body.map-sheet-open .lang-toggle-map, body.sheet-open .lang-toggle-map { display: none; }
}
