:root {
  --bg: #ffffff;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --line: #e3e3e8;
  --accent: #e8a400;
  --price: #f5a623;
  --qh: #d0021b;
  --draft: #8b5cf6;
  --deal: #1e88e5;
  --shadow: 0 4px 18px rgba(0,0,0,.18);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: #222; }
#map { position: absolute; inset: 0; }

.top { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 10; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 80px); pointer-events: none; }
.top > * { pointer-events: auto; }
.search { position: relative; display: flex; background: var(--bg); border-radius: 24px; box-shadow: var(--shadow); width: 100%; max-width: 560px; }
.search input { flex: 1; border: 0; outline: 0; padding: 12px 16px; font-size: 16px; border-radius: 24px; background: transparent; min-width: 0; }
.search button { border: 0; background: var(--accent); color: #fff; font-weight: 600; padding: 0 18px; border-radius: 24px; margin: 4px; cursor: pointer; }
.suggest { position: absolute; top: 100%; left: 0; right: 0; margin: 6px 0 0; padding: 4px 0; list-style: none; background: var(--bg); border-radius: 12px; box-shadow: var(--shadow); max-height: 50vh; overflow: auto; }
.suggest li { padding: 10px 14px; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--line); }
.suggest li:last-child { border-bottom: 0; }
.suggest li:hover, .suggest li.active { background: #fff6dd; }
.suggest li.hist-head { display: flex; justify-content: space-between; align-items: center; padding: 7px 14px; font-size: 12px; font-weight: 600; color: var(--muted); background: #f8f8fa; cursor: default; }
.suggest li.hist-head button { border: 0; background: none; color: var(--deal); font-size: 12px; font-weight: 600; padding: 0; margin: 0; cursor: pointer; }
.suggest small { display: block; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 2px; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; background: rgba(255,255,255,.75); color: var(--muted); font-size: 13px; padding: 7px 12px; border-radius: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.15); cursor: pointer; }
.chip.on { background: var(--bg); color: var(--text); font-weight: 600; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.price { background: var(--price); } .dot.qh { background: var(--qh); } .dot.draft { background: var(--draft); } .dot.deal { background: var(--deal); } .dot.deal.thue { background: #16a34a; } .dot.bv { background: #7c3aed; } .dot.post { background: #ea580c; }
.chip.chip-post { background: #fff7ed; color: #c2410c; font-weight: 700; border: 1px solid #fdba74; }
.chip.chip-post.active { background: #ea580c; color: #fff; border-color: #ea580c; outline: 0; }
.chip.chip-post.active .dot.post { background: #fff; }
.dot.rd-ht { background: #e53935; } .dot.rd-mr { background: #facc15; border: 1px solid #ca8a04; margin-left: -3px; }

.sheet { position: absolute; z-index: 6; left: 10px; right: 10px; bottom: 34px; max-width: 560px; max-height: 55vh; overflow: auto; background: var(--bg); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 16px 12px; }
.sheet h3 { margin: 0 32px 4px 0; font-size: 16px; }
.sheet .addr { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.sheet .block { border-top: 1px solid var(--line); padding: 10px 0; }
.sheet .block h4 { margin: 0 0 6px; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.sheet .item { font-size: 14px; margin: 6px 0; line-height: 1.45; }
.sheet .big { font-size: 18px; font-weight: 700; }
.sheet .src { font-size: 12px; color: var(--muted); }
.sheet .src a { color: var(--deal); }
.sheet .none { font-size: 13px; color: var(--muted); }
.sheet .doc { margin: 8px 0; font-size: 13px; line-height: 1.45; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; color: #fff; }
.tag.qh { background: var(--qh); } .tag.draft { background: var(--draft); }
.close { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--muted); }

.notice { position: absolute; z-index: 7; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(92vw, 460px); background: var(--bg); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; font-size: 14px; line-height: 1.5; }
.notice code { background: #f2f2f5; padding: 1px 5px; border-radius: 4px; }

.disclaimer { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; text-align: center; font-size: 11px; line-height: 1.3; color: #fff; background: rgba(0,0,0,.58); padding: 5px 10px; }

.price-label { background: var(--price); color: #111; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 8px; }

/* ---------- Mua bán / Cho thuê ---------- */
.deal { display: grid; grid-template-columns: 1fr 1fr; background: #f1f1f4; border-radius: 10px; padding: 3px; margin-bottom: 8px; }
.filter-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.filter-head .close { position: static; width: 28px; height: 28px; line-height: 28px; font-size: 20px; border: 0; background: #f1f5f9; border-radius: 50%; cursor: pointer; color: var(--muted); flex-shrink: 0; }
.filter-head .close:hover { background: #e2e8f0; color: var(--text); }
.fswitch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text); user-select: none; }
.fswitch input { position: absolute; opacity: 0; width: 0; height: 0; }
.fswitch-slider { position: relative; width: 38px; height: 22px; border-radius: 999px; background: #cbd5e1; transition: background .18s; flex-shrink: 0; }
.fswitch-slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s; }
.fswitch input:checked + .fswitch-slider { background: #16a34a; }
.fswitch input:checked + .fswitch-slider::after { transform: translateX(16px); }
.chip.off-muted { opacity: .72; }
.chip.off-muted .dot.deal { background: #94a3b8; }
.deal-tab { border: 0; background: none; padding: 8px; border-radius: 8px; font-size: 14px; font-weight: 700; color: var(--muted); cursor: pointer; }
.deal-tab.on { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.modes { grid-template-columns: repeat(2, 1fr) !important; }
.type.mb { border-color: #16a34a; background: #e6f6ec; color: #14532d; }
.chip.active { outline: 2px solid #2f6fe4; }

/* ---------- Phần quy hoạch ---------- */
.qh-panel { font-size: 14px; }
.qh-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; position: relative; }
.qh-head .close { position: static; }
.qh-area { border-top: 1px solid var(--line); padding: 8px 0; }
.qh-panel .doc { margin: 8px 0; line-height: 1.45; }
.qh-panel .src { font-size: 12px; color: var(--muted); }
.qh-panel .src a { color: var(--deal); }
.qh-panel .none { font-size: 13px; color: var(--muted); }
.qh-panel .note { border-top: 1px solid var(--line); padding-top: 8px; }
.bv-ctrl { display: flex; align-items: center; gap: 10px; margin: 8px 0; padding: 8px 10px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.bv-ctrl input[type="range"] { flex: 1; accent-color: #7c3aed; cursor: pointer; }
.bv-ctrl b { min-width: 34px; text-align: right; }
.bv-toggle { border: 1px solid var(--line); background: #fff; color: var(--fg); border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.bv-toggle.on { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.bv-cap { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.45; }

/* ---------- Thông báo nhanh ---------- */
.toast { position: absolute; z-index: 16; left: 50%; top: 108px; bottom: auto; transform: translateX(-50%); width: min(92vw, 420px);
  background: rgba(20,20,24,.92); color: #fff; border-radius: 12px; padding: 9px 14px; font-size: 13.5px; line-height: 1.45; box-shadow: var(--shadow); pointer-events: none; text-align: center; }

/* ---------- Cột nút công cụ bên phải ---------- */
.tools-right { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); z-index: 6; display: flex; flex-direction: column; gap: 6px; }
.tbtn { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--bg); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.22); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.tbtn:hover { background: #fff6dd; }
.tbtn.on { background: var(--accent); color: #fff; }
.tbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Thanh công cụ đo (neo gọn mép trên-phải, không chắn giữa bản đồ) ---------- */
.measure-bar { position: absolute; z-index: 8; right: 58px; top: 10px; width: min(76vw, 240px);
  background: var(--bg); border-radius: 12px; box-shadow: var(--shadow); padding: 8px 10px; font-size: 12.5px; }
.m-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #f1f1f4; border-radius: 8px; padding: 2px; margin-bottom: 8px; }
.m-tab { border: 0; background: none; border-radius: 6px; padding: 6px 4px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.m-tab.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.m-out { font-weight: 700; color: var(--text); margin-bottom: 8px; line-height: 1.4; }
.m-actions { display: flex; gap: 6px; justify-content: flex-end; }
.m-actions button { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 8px; padding: 5px 9px; font-size: 12px; font-weight: 600; cursor: pointer; }
.m-actions button#measureDone { border-color: var(--accent); background: var(--accent); color: #fff; }

/* ---------- Khung chọn lớp quy hoạch nổi gọn dưới đáy bản đồ ---------- */
.qh-dock { position: absolute; z-index: 7; left: 50%; transform: translateX(-50%); bottom: 28px; width: min(920px, calc(100vw - 140px));
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.qh-dock-card { width: 100%; background: transparent; color: var(--text); padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.qh-dock-card > * { pointer-events: auto; }
.qh-meta { background: rgba(255,255,255,.93); backdrop-filter: blur(6px); color: var(--text); border-radius: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.18); padding: 4px 14px; font-size: 11.5px; line-height: 1.35; max-width: 100%; text-align: center; }
.qh-meta a { color: var(--deal); font-weight: 600; }
.qh-meta-sum { cursor: pointer; user-select: none; }
.qh-meta-ico { color: #2563eb; font-weight: 700; margin-left: 4px; }
.qh-meta-detail { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line); text-align: left; max-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.qh-ctrl-bar { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; background: rgba(255,255,255,.95); backdrop-filter: blur(6px); border-radius: 999px; box-shadow: 0 2px 12px rgba(0,0,0,.22); padding: 4px 10px; max-width: 100%; }
.qh-dock-hacts { display: inline-flex; align-items: center; gap: 5px; }
.qh-ctrl-bar .close { position: static; width: 24px; height: 24px; border: 0; background: #f1f5f9; border-radius: 50%; font-size: 17px; line-height: 24px; padding: 0; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.qh-ctrl-bar .close:hover { background: #e2e8f0; color: var(--text); }
.qh-mini-btn { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 999px; padding: 3px 9px; font-size: 11.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.qh-mini-btn:hover { background: #f1f5f9; }
.qh-mini-btn.primary { background: var(--deal); border-color: var(--deal); color: #fff; }
.qh-mini-btn.danger { background: #fff1f2; border-color: #fda4af; color: #be123c; }
.qh-op { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--text); }
.qh-op input { width: 110px; accent-color: #2563eb; cursor: pointer; }
.qh-op b { min-width: 32px; text-align: right; font-size: 11.5px; }
.qh-step { width: 22px; height: 22px; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 50%; font-size: 13px; font-weight: 700; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.qh-step:hover { background: #eff6ff; border-color: #2563eb; color: #2563eb; }
.qh-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; }
.qh-lbtn-grp { display: inline-flex; align-items: center; gap: 2px; }
.qh-lbtn { flex: none; display: inline-flex; align-items: center; gap: 5px; border: 0; background: rgba(255,255,255,.96); color: #1e293b;
  font-size: 12.5px; font-weight: 700; padding: 6px 13px; border-radius: 999px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.22); transition: background .15s, color .15s, transform .1s; }
.qh-lbtn:hover { background: #fff; transform: translateY(-1px); }
.qh-lbtn .qdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.qh-lbtn.on { background: #2563eb; color: #fff; box-shadow: 0 2px 10px rgba(37,99,235,.45); }
.qh-lbtn.on .qdot { box-shadow: 0 0 0 1.5px rgba(255,255,255,.85); }
.qh-lbtn.metro.on { background: #7c3aed; color: #fff; box-shadow: 0 2px 10px rgba(124,58,237,.45); }
.qh-zoom-btn { border: 0; background: rgba(255,255,255,.94); color: var(--muted); border-radius: 999px; padding: 5px 8px; font-size: 11px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.qh-zoom-btn:hover { background: #eff6ff; color: #1d4ed8; }
.pp-infra { max-width: 280px; font-size: 12.5px; line-height: 1.45; }
.pp-infra-title { font-size: 14.5px; font-weight: 800; color: #1e293b; margin-bottom: 4px; }
.pp-infra-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 8px; margin-bottom: 6px; background: #fee2e2; color: #991b1b; }
.pp-infra-tag.metro { background: #f3e8ff; color: #6b21a8; }
.pp-infra-note { margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); font-style: italic; }
.qh-status { background: rgba(255,255,255,.92); border-radius: 999px; padding: 3px 12px; font-size: 11px; color: var(--muted); box-shadow: 0 2px 8px rgba(0,0,0,.16); }
.qh-custom { background: rgba(255,255,255,.97); border-radius: 14px; box-shadow: 0 4px 18px rgba(0,0,0,.22); padding: 9px 12px; display: flex; flex-direction: column; gap: 6px; width: min(520px, 100%); }
.qh-custom-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qh-reopen { position: absolute; z-index: 7; left: 50%; transform: translateX(-50%); bottom: 28px; display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: rgba(255,255,255,.96); color: #1e293b; font-size: 12.5px; font-weight: 700; padding: 7px 15px; border-radius: 999px;
  box-shadow: 0 2px 12px rgba(0,0,0,.24); cursor: pointer; white-space: nowrap; }
.qh-reopen:hover { background: #fff; transform: translateX(-50%) translateY(-1px); }
.qh-reopen[hidden] { display: none; }
.qh-reopen.has-on { background: #2563eb; color: #fff; box-shadow: 0 2px 12px rgba(37,99,235,.45); }
.qh-reopen.has-on .dot.bv { background: #fff; }
.qh-custom-row input[type="url"] { flex: 1; min-width: 160px; padding: 5px 8px; font-size: 12px; }
.qh-file-lbl { font-size: 11.5px; color: var(--muted); }
.qh-custom-row input[type="file"] { font-size: 11.5px; max-width: 210px; }

/* ---------- Chọn nhanh khu vực hành chính & tóm tắt ---------- */
.area-panel { font-size: 13px; }
.area-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.area-summary { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; background: rgba(255,255,255,.96); color: var(--text);
  border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.18); padding: 6px 11px; font-size: 12.5px; width: fit-content; max-width: 100%; }
.area-summary b { color: #1d4ed8; }
.area-summary .as-badge { background: #eff6ff; color: #1e40af; border-radius: 8px; padding: 2px 7px; font-weight: 700; font-size: 11.5px; }
.area-summary .as-badge.rent { background: #ecfdf5; color: #166534; }
.area-summary .as-close { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }

/* ---------- Modal bảng ký hiệu màu đất ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(15,23,42,.48); display: flex; align-items: center; justify-content: center; padding: 12px; }
.modal-backdrop[hidden] { display: none !important; }
.modal-card { width: min(640px, 100%); max-height: 84vh; background: var(--bg); border-radius: 16px; box-shadow: 0 12px 36px rgba(0,0,0,.32); display: flex; flex-direction: column; overflow: hidden; padding: 14px 16px; gap: 10px; }
.modal-card.legend-card { width: min(390px, calc(100vw - 24px)); max-height: min(60vh, 450px); border-radius: 14px; padding: 10px 12px; gap: 7px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-shrink: 0; }
.modal-head b { font-size: 15px; display: block; }
.legend-card .modal-head b { font-size: 14px; }
.modal-head .close { position: static; width: 32px; height: 32px; border-radius: 50%; background: #f1f5f9; color: #334155; font-size: 22px; line-height: 1; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; }
.modal-head .close:hover { background: #e2e8f0; color: #0f172a; }
.modal-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.legend-tabs { display: flex; flex-wrap: wrap; gap: 4px; flex-shrink: 0; }
.ltab { border: 1px solid var(--line); background: #f8fafc; color: var(--muted); border-radius: 12px; padding: 4px 8px; font-size: 11px; font-weight: 600; cursor: pointer; }
.ltab.on { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.legend-search { padding: 6px 9px; font-size: 12.5px; flex-shrink: 0; }
.legend-list { overflow-y: auto; display: grid; grid-template-columns: 1fr; gap: 5px; padding-right: 2px; min-height: 0; flex: 1; }
.legend-item { display: flex; align-items: flex-start; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; }
.legend-swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.18); flex: none; margin-top: 1px; }
.legend-info { min-width: 0; }
.legend-code { display: inline-block; font-family: ui-monospace, Consolas, monospace; font-size: 11px; font-weight: 800; background: #f1f5f9; color: #0f172a; padding: 1px 5px; border-radius: 4px; margin-right: 4px; }
.legend-name { font-size: 12px; font-weight: 700; color: var(--text); }
.legend-desc { font-size: 10.5px; color: var(--muted); line-height: 1.3; margin-top: 2px; }

/* ---------- Bảng góc ranh VN-2000 ---------- */
.vn-panel { font-size: 13px; }
.vn-note { background: #fff8e6; border: 1px solid #f3d27a; color: #5c4300; border-radius: 8px; padding: 7px 9px; font-size: 12px; line-height: 1.4; margin-bottom: 8px; }
.vn-lbl { display: block; font-size: 12px; font-weight: 600; margin: 6px 0 4px; color: var(--text); }
.vn-sel { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; color: var(--text); }
.vn-ta { width: 100%; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; resize: vertical; color: var(--text); }
.vn-acts { display: flex; gap: 8px; margin-top: 8px; }
.vn-acts .apply { margin-top: 0; flex: 1; padding: 9px; font-size: 14px; }
.vn-clr { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 10px; padding: 9px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.vn-warn { margin-top: 8px; background: #fff1f2; border: 1px solid #fda4af; color: #9f1239; border-radius: 8px; padding: 7px 9px; font-size: 12px; line-height: 1.4; }
.vn-gps-btn { margin-top: 6px; border: 0; background: var(--deal); color: #fff; border-radius: 8px; padding: 6px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.vn-out { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; font-size: 12.5px; line-height: 1.5; }
.vn-edges { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; color: var(--muted); font-size: 12px; }
.vn-legal { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; font-size: 11px; color: var(--muted); line-height: 1.4; }

/* ---------- Bảng lọc tin ---------- */
.filter { background: var(--bg); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 14px 10px; width: 100%; max-width: 560px; max-height: calc(100vh - 155px); overflow-y: auto; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode { border: 2px solid var(--line); background: #fafafa; border-radius: 10px; padding: 8px 6px; cursor: pointer; text-align: center; font-size: 13px; color: var(--text); }
.mode b { display: block; } .mode span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.mode.on { border-color: #2f6fe4; background: #eef4ff; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 4px; }
.type { border: 2px solid; border-radius: 8px; padding: 8px; font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; opacity: .45; }
.type.dat { border-color: #e57399; background: #fde8ef; color: #8a1c3d; }
.type.nha { border-color: #e8b923; background: #fff6cc; color: #6b5200; }
.type.on { opacity: 1; }
.frow { border-top: 1px solid var(--line); padding: 8px 0 2px; }
.fhead { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 4px; }
.ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 2px; }
.single { width: 100%; accent-color: #22b8cf; }
.dual { position: relative; height: 22px; }
.dual .track { position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: #ddd; }
.dual.dt .track { background: #7a5a48; } .dual.gia .track { background: #e53935; }
.dual input { position: absolute; left: 0; top: 0; width: 100%; height: 22px; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.dual input::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: pointer; }
.dual input::-moz-range-thumb { pointer-events: auto; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; cursor: pointer; }
.dual.dt input::-webkit-slider-thumb { background: #7a5a48; } .dual.dt input::-moz-range-thumb { background: #7a5a48; }
.dual.gia input::-webkit-slider-thumb { background: #e53935; } .dual.gia input::-moz-range-thumb { background: #e53935; }
.apply { width: 100%; margin-top: 10px; border: 0; border-radius: 10px; padding: 11px; background: #e0a100; color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; }
.fcount { text-align: center; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Ô xem nhanh tin rao & vị trí bản đồ ---------- */
.maplibregl-popup { z-index: 15 !important; }
.maplibregl-popup-content { border-radius: 12px !important; padding: 10px 14px !important; }
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: 26px !important; }
.pp { font-size: 13.5px; line-height: 1.48; min-width: 195px; max-width: 285px; max-height: min(56vh, calc(100vh - 155px)); overflow-y: auto; padding-right: 2px; }
.pp-multi { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; padding-bottom: 5px; border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.pp-mbtn { border: 1px solid var(--line); background: #f8fafc; color: var(--text); border-radius: 7px; padding: 2px 7px; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.pp-mbtn.on { background: #15803d; border-color: #15803d; color: #fff; }
.pp .pp-gal img { height: 135px; }
.pp .pp-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.pp .pp-detail-btn { border: 0; background: #15803d; color: #fff; border-radius: 8px; padding: 6px 11px; font-size: 12.5px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.pp .pp-detail-btn:hover { background: #166534; }
.pp .pp-price { font-size: 18px; font-weight: 800; color: #1565c0; }
.pp .pp-price.dat { color: #b45309; }
.pp .pp-price.thue { color: #15803d; }
.pp .pp-unit { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pp .pp-dir { display: inline-flex; align-items: center; gap: 4px; margin-top: 0; padding: 5px 10px; border-radius: 8px; background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; font-size: 12px; font-weight: 600; text-decoration: none; }
.pp .pp-dir:hover { background: #dbeafe; }

/* ---------- Modal chi tiết căn phòng & lướt toàn bộ ảnh kiểu Shopee ---------- */
.detail-card { width: min(680px, 100%); max-height: 90vh; }
.detail-body { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; font-size: 14px; line-height: 1.55; }
.detail-body > * { flex-shrink: 0; }
.detail-hero { position: relative; background: #0f172a; border-radius: 12px; overflow: hidden; }
.detail-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; -webkit-overflow-scrolling: touch; cursor: grab; user-select: none; }
.detail-track::-webkit-scrollbar { display: none; }
.detail-track.dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; }
.detail-slide { flex: 0 0 100%; width: 100%; height: min(380px, 50vh); scroll-snap-align: start; display: flex; align-items: center; justify-content: center; background: #0f172a; }
.detail-slide a { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.detail-slide img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; pointer-events: none; }
.detail-cnt-pill { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.62); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 12px; pointer-events: none; }
.detail-thumbs { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 2px 0 4px; min-height: 60px; align-items: center; }
.detail-thumb { width: 70px; height: 54px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; flex: none; opacity: .7; transition: opacity .15s, border-color .15s; }
.detail-thumb.on, .detail-thumb:hover { border-color: #15803d; opacity: 1; }
.detail-price { font-size: 21px; font-weight: 800; color: #15803d; }
.detail-price.ban { color: #1565c0; }
.detail-price.dat { color: #b45309; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 13px; }
.detail-meta .full { grid-column: 1 / -1; }
.detail-desc { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.6; }
.detail-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Thanh thông tin khi bấm điểm trống trên bản đồ ---------- */
.point-sheet { position: absolute; z-index: 11; left: 14px; right: 58px; bottom: 180px; max-width: 420px; max-height: calc(100vh - 290px); overflow-y: auto;
  background: rgba(255,255,255,.98); color: var(--text); border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.26); padding: 10px 12px; font-size: 13px; line-height: 1.45; }
.ps-qh-box { display: flex; align-items: flex-start; gap: 9px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 8px 10px; margin: 6px 0 8px; }
.ps-qh-swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.18); flex: none; margin-top: 2px; }
.ps-qh-body { flex: 1; min-width: 0; font-size: 12px; line-height: 1.4; }
.ps-qh-title { font-size: 13px; font-weight: 700; color: #0f172a; }
.ps-qh-code { display: inline-block; background: #1e293b; color: #fff; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 5px; margin-right: 5px; vertical-align: middle; }
.ps-qh-desc { color: #475569; margin-top: 2px; }
.ps-qh-src { color: #64748b; font-size: 11px; margin-top: 3px; }
.ps-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.ps-head .close { position: static; font-size: 20px; line-height: 1; padding: 0 4px; }
.ps-coord { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; font-weight: 700; color: #1e293b; }
.ps-info { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.ps-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.ps-btn { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.ps-btn.primary { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.ps-btn:hover { opacity: .9; }
.pp .pp-src { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pp .pp-note { font-size: 11px; color: var(--muted); }
.pp .pp-src a { color: var(--muted); }

/* ---------- Form đăng tin & popup tin người dùng ---------- */
.hp-field { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }
.post-panel { font-size: 13px; }
.post-tabs { margin-bottom: 10px; }
.post-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.post-lbl-row { display: flex; justify-content: space-between; align-items: baseline; }
.post-cnt { font-size: 11px; color: var(--muted); }
.post-ta { font-family: inherit; font-size: 13px; }
.post-loc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.post-pick-btn { border: 1.5px solid #ea580c; background: #fff7ed; color: #c2410c; border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.post-pick-btn.on { background: #ea580c; color: #fff; }
.post-coord { font-size: 12px; color: var(--muted); }
.post-file { width: 100%; font-size: 12.5px; }
.post-files { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.post-file-item { display: flex; justify-content: space-between; align-items: center; gap: 6px; background: #f8fafc; border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; font-size: 12px; }
.post-file-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-file-item button { border: 0; background: none; color: #b91c1c; font-weight: 700; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.post-agree { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; font-size: 12.5px; line-height: 1.4; cursor: pointer; }
.post-agree input { margin-top: 2px; flex: none; }
.post-privacy { margin-top: 6px; font-size: 11.5px; line-height: 1.45; color: var(--muted); background: #f8f8fa; border-radius: 8px; padding: 7px 9px; }
.post-ok { padding: 8px 2px; }
.post-ok-title { font-size: 16px; font-weight: 700; color: #15803d; margin-bottom: 6px; }
.post-ok-note { margin: 0 0 8px; font-size: 12.5px; line-height: 1.45; }
.post-code-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.post-code-row code { flex: 1; background: #fff7ed; border: 1.5px dashed #ea580c; color: #9a3412; font-size: 15px; font-weight: 700; padding: 8px 10px; border-radius: 8px; text-align: center; letter-spacing: .5px; }
.post-ok-msg { background: #ecfdf5 !important; border-color: #6ee7b7 !important; color: #065f46 !important; }

.pp-user { max-width: 290px; max-height: 62vh; overflow-y: auto; font-size: 13px; line-height: 1.45; }
.pp-unverified { display: inline-block; background: #fff7ed; border: 1px solid #fdba74; color: #c2410c; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; margin-bottom: 6px; }
.pp-user .pp-price { color: #ea580c; font-size: 17px; }
.pp-gal { position: relative; margin: 4px 0 6px; background: #111; border-radius: 8px; overflow: hidden; }
.pp-gal img { display: block; width: 100%; height: 165px; object-fit: cover; cursor: pointer; }
.pp-gal-nav { position: absolute; top: 50%; transform: translateY(-50%); border: 0; background: rgba(0,0,0,.58); color: #fff; width: 28px; height: 28px; border-radius: 50%; font-size: 17px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pp-gal-nav.prev { left: 6px; }
.pp-gal-nav.next { right: 6px; }
.pp-gal-cnt { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 8px; }
.pp-desc { margin: 5px 0; padding: 5px 7px; background: #f8f8fa; border-radius: 6px; font-size: 12px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; max-height: 90px; overflow: auto; }
.pp-contact { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line); font-size: 12.5px; }
.pp-contact a { color: #c2410c; font-weight: 700; text-decoration: none; }
.pp-vid { margin: 6px 0; border-radius: 8px; overflow: hidden; background: #000; }
.pp-vid video { display: block; width: 100%; max-height: 185px; background: #000; }

.post-coord-box { margin-top: 6px; padding: 8px 9px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; }
.post-cmode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 4px 0 6px; }
.post-cm-btn { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 7px; padding: 5px 6px; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.post-cm-btn.on { border-color: #ea580c; background: #fff7ed; color: #c2410c; }
.post-vn-note { margin-top: 4px; font-size: 11px; color: var(--muted); line-height: 1.35; }
.post-media-box { margin-top: 6px; padding: 8px 9px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; }
.post-sub-lbl { display: block; font-size: 11.5px; color: var(--muted); margin: 6px 0 3px; }
.post-id-row { font-size: 12.5px; margin-bottom: 6px; }
.post-id-row code { background: #f1f5f9; padding: 2px 6px; border-radius: 5px; font-weight: 700; color: #1e293b; }

.my-posts-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; margin-bottom: 8px; }
.my-post-item { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; }
.my-post-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.my-post-title { font-weight: 700; font-size: 13px; color: var(--text); line-height: 1.35; }
.my-post-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.my-post-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.st-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.st-cho_duyet { background: #fef3c7; color: #92400e; }
.st-dang_hien { background: #dcfce7; color: #166534; }
.st-het_han { background: #e5e7eb; color: #374151; }
.st-tu_choi { background: #fee2e2; color: #991b1b; }
.st-da_go { background: #f3f4f6; color: #6b7280; }
.my-post-rm { border: 1px solid #fca5a5; background: #fff1f2; color: #b91c1c; border-radius: 7px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.go-other-box { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }

/* ---------- Thanh xem trước & kéo ghim ---------- */
.preview-bar { position: absolute; z-index: 8; left: 10px; right: 10px; bottom: 32px; max-width: 520px;
  background: var(--bg); border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.28); padding: 12px 14px; font-size: 13px; }
.preview-guide { background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; border-radius: 8px; padding: 7px 10px; font-size: 12.5px; font-weight: 600; line-height: 1.4; margin-bottom: 8px; }
.preview-card { max-height: 28vh; overflow-y: auto; line-height: 1.45; }
.preview-price { font-size: 16px; font-weight: 800; color: #ea580c; }
.preview-media { display: flex; gap: 6px; overflow-x: auto; margin-top: 6px; padding-bottom: 2px; }
.preview-media img { width: 68px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); flex: none; }
.preview-media video { height: 54px; max-width: 110px; border-radius: 6px; border: 1px solid var(--line); background: #000; flex: none; }
.preview-acts { display: flex; gap: 8px; margin-top: 10px; }
.preview-acts .apply { margin-top: 0; flex: 1; padding: 9px; font-size: 14px; }
.preview-acts .apply:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 780px) {
  .qh-dock { left: 10px; right: 58px; transform: none; width: auto; bottom: 66px; }
}
@media (max-width: 600px) {
  .post-grid2 { grid-template-columns: 1fr; }
  .post-cmode { grid-template-columns: 1fr; }
  .pp-user { max-width: 260px; max-height: 56vh; }
  .pp-gal img { height: 115px; }
  .pp-vid video { max-height: 135px; }
  .preview-bar { left: 8px; right: 8px; bottom: 26px; padding: 10px 11px; font-size: 12.5px; }
  .preview-card { max-height: 24vh; }
}

@media (max-width: 780px) {
  .qh-dock { left: 10px; right: 58px; transform: none; width: auto; bottom: 66px; }
}
@media (max-width: 600px) {
  .top { top: 8px; left: 8px; right: 8px; gap: 6px; max-width: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .search input { padding: 10px 12px; font-size: 15px; }
  .search button { padding: 0 14px; font-size: 14px; }
  .chip { font-size: 12px; padding: 6px 10px; }
  .filter { padding: 10px 12px; max-height: calc(100vh - 135px); }
  .ticks { font-size: 9px; }
  .tools-right { right: 8px; gap: 5px; }
  .tbtn { width: 36px; height: 36px; border-radius: 10px; }
  .tbtn svg { width: 18px; height: 18px; }
  .measure-bar { left: 8px; right: 52px; top: auto; bottom: 36px; width: auto; padding: 8px 10px; }
  .point-sheet { left: 8px; right: 52px; bottom: 162px; padding: 9px 10px; max-height: 44vh; overflow-y: auto; }
  .disclaimer { font-size: 10px; padding: 4px 8px; }
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: 28px !important; }
  .qh-dock { left: 8px; right: 50px; transform: none; width: auto; bottom: 68px; }
  .qh-ctrl-bar { padding: 4px 8px; gap: 5px; border-radius: 14px; width: 100%; box-sizing: border-box; flex-wrap: wrap; justify-content: space-between; overflow: hidden; }
  .qh-dock-hacts { flex: 1 1 100%; display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-right: 2px; }
  .qh-dock-hacts::-webkit-scrollbar { display: none; }
  .qh-ctrl-bar .close { position: sticky; right: 0; margin-left: auto; flex-shrink: 0; background: #e2e8f0; box-shadow: -6px 0 8px rgba(255,255,255,.95); }
  .qh-op { flex: 1 1 auto; }
  .qh-op input { width: 64px; flex: 1; }
  .qh-btns { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; padding: 2px 0; -webkit-overflow-scrolling: touch; }
  .qh-btns::-webkit-scrollbar { display: none; }
  .qh-lbtn { font-size: 11.5px; padding: 5px 10px; }
  .qh-reopen { bottom: 68px; font-size: 12px; padding: 6px 13px; }
  .qh-meta { font-size: 10.5px; padding: 3px 10px; max-height: 76px; overflow-y: auto; }
  .area-grid { grid-template-columns: 1fr; }
  .legend-list { grid-template-columns: 1fr; }
  .toast { top: 96px; bottom: auto; font-size: 12.5px; z-index: 16; }
}

@media (min-width: 900px) {
  .sheet { left: auto; right: 10px; top: 10px; bottom: auto; width: 380px; max-height: calc(100vh - 60px); }
}
