/* Giao diện DP RENT – nền tối theo thiết kế docs/so-do/thiet-ke-tim-kiem.jpg */
:root {
  --bg: #0b1220;
  --bg-2: #0f1828;
  --panel: #131e31;
  --panel-2: #18253c;
  --line: #24324b;
  --text: #e6ebf3;
  --muted: #8d9ab1;
  --primary: #3b82f6;
  --primary-2: #2563eb;
  --accent: #f472b6;
  --green: #16a34a;
  --yellow: #f59e0b;
  --red: #dc2626;
  --star: #60a5fa;
  --radius: 12px;
  --header-h: 60px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: #93c5fd; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 8px 0; }
h2 { font-size: 18px; margin: 4px 0 12px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
h4 { margin: 12px 0 6px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%;
}
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--primary); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
label { display: block; color: var(--muted); font-size: 13px; }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--text); }
pre.note { white-space: pre-wrap; font: inherit; background: var(--bg-2); padding: 8px; border-radius: 8px; }

/* ---------- Thanh đầu trang ---------- */
.header {
  position: sticky; top: 0; z-index: 1000; height: var(--header-h);
  display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: #0a101c; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none !important; flex-shrink: 0; }
.brand .home { font-size: 26px; color: #fff; line-height: 1; }
.brand .logo {
  font-size: 26px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(90deg, #f9a8d4, #c084fc); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.head-search { flex: 1; max-width: 420px; margin: 0 auto; }
.head-search input { border-radius: 999px; background: #121b2c; padding: 8px 16px; }
.head-nav { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border-radius: 999px;
  background: #161f31; border: 1px solid var(--line); color: var(--text); cursor: pointer; white-space: nowrap; font-size: 13px;
}
.pill:hover { background: #1d2940; text-decoration: none; }
.pill.on { border-color: var(--primary); color: #bfdbfe; }
.pill.accent { background: var(--primary-2); border-color: var(--primary-2); }
.bell { position: relative; }
.count {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--red);
  color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.bell .count { position: absolute; top: -6px; right: -6px; }
.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: 40px; min-width: 210px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px; box-shadow: 0 10px 30px #0008; display: flex; flex-direction: column;
}
.menu-list a, .menu-list button { padding: 8px 10px; border-radius: 8px; color: var(--text); background: none; border: 0; text-align: left; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--panel-2); text-decoration: none; }

/* ---------- Thành phần chung ---------- */
.app { min-height: calc(100vh - var(--header-h)); }
.page { max-width: 1200px; margin: 0 auto; padding: 16px; }
.page.narrow { max-width: 860px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; margin-top: 12px; }
.row.wrap, .wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.center { text-align: center; margin: 12px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.section-title { margin: 20px 0 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #20304d; text-decoration: none; }
.btn.primary { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.btn.primary:hover { background: var(--primary); }
.btn.ghost { background: transparent; }
.btn.danger { background: #7f1d1d; border-color: #991b1b; color: #fff; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.big { padding: 12px 18px; font-size: 15px; font-weight: 600; width: 100%; }
.btn.on { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: #93c5fd; cursor: pointer; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 18px; padding: 2px 6px; border-radius: 6px; }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn.on { color: var(--accent); }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
}
.badge.big { font-size: 13px; padding: 4px 12px; }
.pkg { font-size: 11px; padding: 1px 8px; border-radius: 6px; font-weight: 600; }
.pkg-A { background: #064e3b; color: #6ee7b7; }
.pkg-B { background: #78350f; color: #fcd34d; }
.stars { color: var(--star); letter-spacing: 1px; }
.stars .muted { color: #334155; }
.price { color: #fff; font-size: 16px; }
.price small { color: var(--muted); font-weight: 400; font-size: 12px; }
.price.big { font-size: 26px; font-weight: 700; margin: 6px 0; }
.free { color: #4ade80; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .btn { margin-top: 8px; }
.notice { background: #172554; border: 1px solid #1e3a8a; border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.notice.warn { background: #422006; border-color: #78350f; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { padding: 3px 10px; border-radius: 999px; background: var(--panel-2); font-size: 12px; }
.tags .off, .off { opacity: .4; }
.chk { display: flex; align-items: center; gap: 6px; color: var(--text); padding: 2px 0; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.sub { color: var(--muted); font-size: 12px; margin: 8px 0 2px; text-transform: uppercase; letter-spacing: .5px; }

/* Ảnh / ảnh thay thế */
.cover {
  background-size: cover; background-position: center; border-radius: 10px; aspect-ratio: 4/3; width: 100%;
  display: flex; align-items: center; justify-content: center; color: #ffffffcc; font-weight: 700; font-size: 18px;
}
.cover.big { aspect-ratio: 16/9; font-size: 32px; }
.cover.small { aspect-ratio: 16/9; margin-bottom: 8px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.thumbs img { width: 90px; height: 70px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.thumbs.big img { width: 220px; height: 160px; }
.thumb-x { position: relative; }
.thumb-x button { position: absolute; top: 2px; right: 2px; background: #000a; border: 0; color: #fff; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; }

/* Bảng */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.num { text-align: right !important; white-space: nowrap; }
.plus { color: #4ade80; }
.minus { color: #f87171; }
tr.dim { opacity: .5; }
.kv { width: 100%; border-collapse: collapse; }
.kv th, .kv td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.kv th { color: var(--muted); font-weight: 400; width: 45%; }
.kv tr.total th, .kv tr.total td, .total { font-weight: 700; color: #fff; }

/* ---------- Trang tìm kiếm (danh sách trái – bản đồ phải) ---------- */
body[data-page="tim-kiem"] .app, body[data-page="danh-sach"] .app { min-height: 0; }
.search-top { padding: 10px 16px 0; background: var(--bg); }
.search-bar { display: grid; grid-template-columns: 2fr repeat(3, 1fr) 1fr 1fr auto; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; font-size: 12px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); cursor: pointer; width: auto;
}
.chip.on { border-color: var(--primary); color: #bfdbfe; }
.chip .x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 0 0 4px; }

.maps-layout {
  display: grid; grid-template-columns: minmax(380px, 430px) 1fr;
  height: calc(100vh - var(--header-h) - 104px); border-top: 1px solid var(--line);
}
.maps-layout.list-only { grid-template-columns: 1fr; height: auto; }
.maps-layout.list-only .map-pane, .maps-layout.list-only ~ .mobile-toggle { display: none; }
.maps-layout.list-only .list-pane { max-width: 1200px; width: 100%; margin: 0 auto; overflow: visible; }
.maps-layout.list-only #results .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 0 16px; }
.list-pane { overflow-y: auto; background: var(--bg-2); border-right: 1px solid var(--line); position: relative; }
.quick-filters { display: flex; gap: 6px; padding: 10px 12px; position: sticky; top: 0; z-index: 5; background: var(--bg-2); }
.qf {
  flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px; background: #172238; border: 1px solid #2a3a58;
  color: var(--text); font-size: 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#toggle-filters { flex: 0 0 auto; }
.qf.on, .qf.open { border-color: var(--primary); color: #bfdbfe; }
.filter-panel { margin: 0 12px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 12px 12px; }
.filters details { border-bottom: 1px solid var(--line); padding: 6px 0; }
.filters details:last-child { border-bottom: 0; }
.filters summary { cursor: pointer; font-weight: 600; padding: 4px 0; list-style: none; display: flex; justify-content: space-between; }
.filters summary::after { content: '▾'; color: var(--muted); }
.filters details[open] summary::after { content: '▴'; }
.filters .grp { padding: 4px 0 6px; display: flex; flex-direction: column; gap: 4px; }
.filters .grp .row label { flex: 1; }
.filter-actions { justify-content: flex-end; margin-top: 10px; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 12px 8px; color: var(--muted); font-size: 12px; }
.sort-select { width: auto; background: transparent; border: 0; color: var(--text); font-size: 12px; padding: 2px; cursor: pointer; }
#suggest .section-title { padding: 0 12px; }

/* Thẻ căn hộ kiểu DP RENT */
.list { display: flex; flex-direction: column; }
.list.two { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card .card-body { padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.card .title { color: #fff; font-weight: 600; }
.card-row { display: grid; grid-template-columns: 112px 1fr; gap: 12px; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; transition: background .15s; }
.list.two .card-row { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.card-row:hover, .card-row.sel { background: #15213a; }
.card-row.sel { box-shadow: inset 3px 0 0 var(--primary); }
.card-row .card-img .cover { aspect-ratio: 1/1; height: 100%; max-height: 100px; }
.card-row .card-body { padding: 0; }
.card-row .title { font-size: 14px; line-height: 1.3; }
.sub-price { color: #60a5fa; font-size: 12px; }
.specs { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); align-items: center; }
.card-actions { gap: 2px; }
.detail { font-size: 12px; color: #60a5fa; }
.heart { font-size: 20px; line-height: 1; }

/* Bản đồ */
.map-pane { position: relative; }
#map { position: absolute; inset: 0; background: #0b1220; }
#map.drawing { cursor: crosshair; }
.map-overlay { position: absolute; z-index: 500; display: flex; gap: 6px; }
.map-overlay.top { top: 10px; left: 10px; }
.map-overlay.right { top: 10px; right: 10px; flex-direction: column; }
.map-overlay.bottom { bottom: 10px; left: 10px; }
.map-ctl {
  background: #0f1828e6; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 10px;
  cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 12px; width: auto;
}
.map-ctl.on { border-color: var(--accent); color: var(--accent); }
.legend { display: flex; gap: 12px; font-size: 12px; flex-wrap: wrap; }
.map-overlay.legend { background: #0f1828e6; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 4px; vertical-align: middle; }
.mobile-toggle { display: none; }

/* Ghim bong bóng giá */
.pin { background: none; border: 0; }
.pin-in {
  position: relative; display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 10px;
  background: #1e3a6e; border: 2px solid #9ec5ff; color: #fff; font-weight: 700; font-size: 13px; white-space: nowrap;
  box-shadow: 0 3px 10px #0009; transform: translate(-50%, 0); left: 50%; transition: transform .12s, background .12s;
}
.pin-in::after {
  content: ''; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #9ec5ff; border-bottom: 0;
}
.pin-in i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; }
.pin:hover .pin-in, .pin.hl .pin-in { background: var(--primary-2); transform: translate(-50%, 0) scale(1.15); }
.pin-tooltip.leaflet-tooltip { background: #0f1828; border: 1px solid #3b5b8f; border-radius: 10px; padding: 6px; color: var(--text); box-shadow: 0 8px 24px #000a; }
.pin-tooltip.leaflet-tooltip-top::before { border-top-color: #3b5b8f; }
.pin-tip { width: 170px; white-space: normal; text-align: center; font-size: 12px; }
.pin-tip .tip-cover { aspect-ratio: 16/10; margin-bottom: 4px; font-size: 13px; }
.gm-popup .leaflet-popup-content-wrapper { background: var(--panel); color: var(--text); border-radius: 12px; padding: 0; overflow: hidden; }
.gm-popup .leaflet-popup-content { margin: 0; width: 280px !important; }
.gm-popup .leaflet-popup-tip { background: var(--panel); }
.gm-popup a.leaflet-popup-close-button { color: #fff; }
.gm-card .gm-cover { border-radius: 0; aspect-ratio: 16/9; }
.gm-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.gm-title { font-size: 16px; font-weight: 700; color: #fff; }
.gm-actions { display: flex; gap: 6px; margin-top: 6px; }
.gm-actions .btn { color: #fff; text-decoration: none; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { background: #0b1220cc !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: #93c5fd !important; }
.leaflet-bar a { background: var(--panel) !important; color: var(--text) !important; border-color: var(--line) !important; }

/* ---------- Tòa nhà / căn hộ ---------- */
.bld-head, .apt-head { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.photos { display: grid; grid-template-columns: 2fr 1fr; gap: 6px; }
.photos .cover.big { grid-row: span 3; aspect-ratio: auto; min-height: 280px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.stats div, .kpis div { background: var(--panel-2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; }
.stats b { font-size: 18px; color: #fff; }
.stats span, .kpis span { color: var(--muted); font-size: 12px; }
.amenities { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.amen { background: var(--panel-2); border-radius: 10px; padding: 10px; text-align: center; font-size: 12px; }
.amen span { display: block; font-size: 24px; }
.amen.off { opacity: .3; }
.mini-map { height: 240px; border-radius: 10px; margin-top: 12px; }
.floors { display: flex; flex-direction: column; gap: 8px; }
.floor { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: start; }
.floor-label { background: var(--panel-2); border-radius: 8px; padding: 8px; text-align: center; font-weight: 600; font-size: 12px; }
.floor-apts { display: flex; flex-wrap: wrap; gap: 6px; }
.apt-chip {
  display: flex; flex-direction: column; min-width: 110px; padding: 6px 10px; border-radius: 8px; font-size: 11px; color: var(--text);
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 14%, transparent);
}
.apt-chip b { color: var(--c); font-size: 14px; }
.apt-chip:hover { text-decoration: none; background: color-mix(in srgb, var(--c) 28%, transparent); }
.rating-sum { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: center; margin-bottom: 12px; }
.big-score { text-align: center; }
.big-score b { font-size: 40px; color: #fff; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 32px; gap: 8px; align-items: center; font-size: 12px; }
.bar { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--star); }
.review { border-top: 1px solid var(--line); padding: 10px 0; }
.review p { margin: 4px 0; }
.media-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; }
.media-tags span { background: var(--panel-2); padding: 3px 10px; border-radius: 999px; }
.buy-box { position: sticky; top: calc(var(--header-h) + 12px); align-self: start; }
.buy-box h1 { font-size: 20px; }
.cost-box { background: var(--bg-2); border-radius: 10px; padding: 10px; margin: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.cost-box .total { border-top: 1px dashed var(--line); padding-top: 4px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 0 16px; }
.compare { border-collapse: collapse; width: 100%; min-width: 640px; }
.compare th, .compare td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.compare thead th { width: 22%; }
.compare tbody th { color: var(--muted); font-weight: 400; width: 16%; }
.compare td.best { background: #052e1a; color: #86efac; font-weight: 600; }

/* ---------- Đặt phòng / đơn thuê ---------- */
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
.two-col.wide-left { grid-template-columns: 2fr 1fr; }
.steps-hint { padding-left: 18px; }
.steps-hint li { margin: 3px 0; }
.stepper { display: flex; list-style: none; padding: 0; margin: 12px 0 16px; gap: 4px; overflow-x: auto; }
.stepper li { flex: 1; min-width: 92px; text-align: center; font-size: 11px; color: var(--muted); position: relative; padding-top: 34px; }
.stepper li span {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 28px; height: 28px; border-radius: 50%;
  background: var(--panel-2); border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.stepper li.done { color: #86efac; }
.stepper li.done span { background: #14532d; border-color: var(--green); }
.stepper li.cur { color: #fff; font-weight: 600; }
.stepper li.cur span { background: var(--primary-2); border-color: #93c5fd; }
.action-box { border-color: #1e40af; }
.escrow-state { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.escrow-state div { background: var(--panel-2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; }
.escrow-state span { color: var(--muted); font-size: 12px; }
.escrow-state b { color: #fff; font-size: 16px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { padding: 4px 0 10px 14px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.pkg-choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; color: var(--text); cursor: pointer; }
.pkg-choice:has(input:checked) { border-color: var(--primary); background: #0f1f3d; }
.pkg-choice p { margin: 4px 0 0; color: var(--muted); }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.grid-form h3, .grid-form .full { grid-column: 1 / -1; }
.grid-form h3 { margin: 0; }
.narrow-form { max-width: 480px; }

/* Hợp đồng / hóa đơn (bản in) */
.printable { background: #fff; color: #111; border-radius: 8px; padding: 32px; line-height: 1.6; }
.printable h2, .printable h3 { color: #111; }
.printable .table th, .printable .table td { border-color: #ddd; color: #111; }
.contract h3 { font-size: 14px; margin: 14px 0 4px; }
.sigs { display: flex; justify-content: space-around; gap: 16px; margin-top: 32px; text-align: center; }
.sig { min-width: 160px; }
.sig div { margin-top: 12px; min-height: 48px; color: #1d4ed8; }

/* ---------- Bảng điều khiển ---------- */
.dash { display: grid; grid-template-columns: 240px 1fr; max-width: 1280px; margin: 0 auto; min-height: calc(100vh - var(--header-h)); }
.dash-nav { border-right: 1px solid var(--line); padding: 16px 8px; display: flex; flex-direction: column; gap: 2px; }
.dash-nav .me { padding: 8px 12px 14px; display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.dash-nav .me span { color: var(--muted); font-size: 12px; }
.dash-nav a { padding: 9px 12px; border-radius: 8px; color: var(--text); display: flex; justify-content: space-between; align-items: center; }
.dash-nav a:hover { background: var(--panel); text-decoration: none; }
.dash-nav a.on { background: #172554; color: #bfdbfe; }
.dash-main { padding: 16px 20px; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpis b { font-size: 18px; color: #fff; }
.notif { list-style: none; padding: 0; }
.notif li { display: flex; justify-content: space-between; gap: 12px; padding: 10px; border-bottom: 1px solid var(--line); }
.notif li.unread { background: #111d33; }
.notif li.unread a { font-weight: 600; }
.threads { list-style: none; padding: 0; }
.thread { width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; cursor: pointer; }
.thread:hover { background: var(--panel-2); }
.chat { display: flex; flex-direction: column; gap: 8px; }
.chat-list { height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px; }
.msg { align-self: flex-start; max-width: 80%; background: var(--panel-2); border-radius: 12px 12px 12px 2px; padding: 8px 10px; }
.msg.me { align-self: flex-end; background: var(--primary-2); border-radius: 12px 12px 2px 12px; }
.msg span { display: block; font-size: 10px; opacity: .7; margin-top: 2px; }
.chat-form { display: flex; gap: 6px; }
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding: 10px; background: var(--panel); border-radius: var(--radius); }
.bc { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 11px; color: var(--muted); }
.bc i { width: 100%; max-width: 48px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.bc .v { color: var(--text); }

/* Đăng nhập / đăng ký */
.auth { max-width: 440px; margin: 40px auto; padding: 0 16px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.role-pick label { flex: 1; text-align: center; padding: 8px 4px; cursor: pointer; color: var(--text); font-size: 13px; }
.role-pick label:has(input:checked) { background: var(--primary-2); }
.role-pick input { display: none; }

/* Thanh so sánh, hộp thoại, thông báo nổi */
.compare-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 1100; display: flex; gap: 16px; align-items: center;
  background: var(--panel); border: 1px solid var(--primary); border-radius: 999px; padding: 8px 10px 8px 18px; box-shadow: 0 10px 30px #000a;
  max-width: calc(100vw - 32px);
}
.modal { position: fixed; inset: 0; z-index: 2000; background: #000a; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); width: 100%; max-width: 620px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.toasts { position: fixed; top: calc(var(--header-h) + 10px); right: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #14532d; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 20px #0008; max-width: 340px; animation: in .2s ease-out; }
.toast.error { background: #7f1d1d; }
@keyframes in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Màn hình nhỏ ---------- */
@media (max-width: 1100px) {
  .search-bar { grid-template-columns: 1fr 1fr 1fr; }
  .head-search { display: none; }
}
@media (max-width: 860px) {
  .header { gap: 8px; padding: 0 12px; }
  .brand .logo { font-size: 20px; }
  .head-nav { overflow-x: auto; }
  .head-nav .pill { padding: 5px 10px; }
  .maps-layout { grid-template-columns: 1fr; height: calc(100vh - var(--header-h) - 150px); }
  .maps-layout[data-mobile="list"] .map-pane { display: none; }
  .maps-layout[data-mobile="map"] .list-pane { display: none; }
  .maps-layout.list-only { height: auto; }
  .maps-layout.list-only #results .list, .list.two { grid-template-columns: 1fr; }
  .mobile-toggle {
    display: block; position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 1050;
    background: #111827; color: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 10px 20px; box-shadow: 0 6px 20px #000a;
  }
  body[data-page="tim-kiem"] .compare-bar { bottom: 70px; }
  .bld-head, .apt-head, .two-col, .two-col.wide-left, .rating-sum { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .dash { grid-template-columns: 1fr; }
  .dash-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .dash-nav .me { display: none; }
  .dash-nav a { white-space: nowrap; }
  .grid-form { grid-template-columns: 1fr; }
  .escrow-state { grid-template-columns: 1fr; }
  .buy-box { position: static; }
  .compare-bar { border-radius: 14px; flex-direction: column; gap: 6px; }
}
@media (max-width: 560px) {
  .search-bar { grid-template-columns: 1fr 1fr; }
  .search-bar input[name=q], .search-bar button { grid-column: 1 / -1; }
  .head-nav .pill:not(.accent):not(.bell):not(#user-btn) { display: none; }
  .card-row { grid-template-columns: 90px 1fr; }
  .printable { padding: 16px; }
}

/* ---------- In / lưu PDF ---------- */
@media print {
  body { background: #fff; color: #000; }
  .header, .compare-bar, .toasts, .no-print, .crumbs, .dash-nav, .mobile-toggle, .modal-head { display: none !important; }
  .modal { position: static; background: none; padding: 0; }
  .modal-box { border: 0; max-height: none; background: #fff; }
  .modal:not([hidden]) ~ * { display: none; }
  body:has(.modal:not([hidden])) .app { display: none; }
  .printable { padding: 0; }
  .page { max-width: none; padding: 0; }
}
