/* Anything with the HTML "hidden" attribute must stay hidden, even if a class sets display:grid/flex */
[hidden] { display: none !important; }

/* ============ Theme ============ */
:root {
  --brand: #12355b;
  --brand-2: #2563eb;
  --brand-soft: #e8efff;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f7fb;
  --card: #ffffff;
  --green: #15803d;
  --green-soft: #dcfce7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --amber: #a16207;
  --amber-soft: #fef3c7;
  --violet: #6d28d9;
  --violet-soft: #ede9fe;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.08);
  --header-h: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --brand: #93c5fd;
  --brand-2: #60a5fa;
  --brand-soft: #1e293b;
  --ink: #f1f5f9;
  --ink-2: #cbd5e1;
  --muted: #94a3b8;
  --line: #273244;
  --bg: #0b1220;
  --card: #111a2c;
  --green: #4ade80; --green-soft: #052e16;
  --red: #f87171; --red-soft: #3b0d0d;
  --amber: #fbbf24; --amber-soft: #3a2a05;
  --violet: #c4b5fd; --violet-soft: #2e1065;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
.container { max-width: 1320px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ============ Header ============ */
.header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header .container { height: 100%; display: flex; align-items: center; gap: 20px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; color: var(--brand); }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #12355b, #2563eb); color: #fff; display: grid; place-items: center; font-size: 18px; }
.logo-img { height: 38px; width: auto; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.hero { display: flex; align-items: center; gap: 20px; margin-top: 18px; padding: 18px 22px; border-radius: var(--radius); background: linear-gradient(110deg, #0f1724 0%, #1f2937 60%, #3b2f12 100%); color: #fff; }
.hero img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; object-position: top; border: 3px solid #c9971c; background: #fff; flex-shrink: 0; }
.hero h2 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.hero p { margin: 2px 0 0; color: #cbd5e1; font-size: 14px; }
.hero-k { color: #e5b53a; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.hero .btn { margin-left: auto; background: #c9971c; }
.agent-box { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.agent-box img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; object-position: top; background: #fff; }
.agent-box .ab-ico { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: #fff; border: 1px solid var(--line); font-size: 20px; }
.agent-box b { display: block; margin-bottom: 2px; }
.agent-box .k { font-size: 12px; color: var(--muted); }
.mb-agent { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: top; background: #fff; flex-shrink: 0; }
.nav { display: flex; gap: 6px; margin-left: 12px; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.nav a:hover, .nav a.active { background: var(--brand-soft); color: var(--brand-2); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill-count { background: var(--brand-2); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; margin-left: 4px; }

/* ============ Buttons ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; padding: 10px 16px; font-weight: 600; border: 1px solid transparent; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand-2); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--card); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand-2); color: var(--brand-2); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); display: inline-grid; place-items: center; font-size: 17px; }
.icon-btn:hover { border-color: var(--brand-2); }
.icon-btn.on-fav { color: #e11d48; border-color: #fecdd3; }
.icon-btn.on-dis { color: var(--ink); background: var(--line); }

/* ============ Toolbar / filters ============ */
.toolbar { position: sticky; top: var(--header-h); z-index: 40; background: var(--card); border-bottom: 1px solid var(--line); }
.toolbar .container { display: flex; align-items: center; gap: 10px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.search input { border: 0; background: transparent; outline: none; padding: 10px 0; width: 100%; }
.chip-select { position: relative; }
.chip-select select { appearance: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 30px 9px 12px; font-weight: 500; cursor: pointer; }
.chip-select::after { content: "▾"; position: absolute; right: 11px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); font-size: 12px; }
.chip-select select.active { border-color: var(--brand-2); color: var(--brand-2); background: var(--brand-soft); }
.views { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.views button { background: var(--card); border: 0; padding: 9px 13px; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 13px; }
.views button + button { border-left: 1px solid var(--line); }
.views button.active { background: var(--brand-soft); color: var(--brand-2); }

.more-filters { display: none; border-top: 1px solid var(--line); }
.more-filters.open { display: block; }
.more-filters .container { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; padding-top: 14px; padding-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.field input, .field select { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; color: var(--ink); padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.check { flex-direction: row; align-items: center; gap: 8px; text-transform: none; font-size: 14px; color: var(--ink); font-weight: 500; letter-spacing: 0; }
.check input { width: 17px; height: 17px; accent-color: var(--brand-2); }

/* ============ Results head ============ */
.results-head { display: flex; align-items: baseline; gap: 14px; padding: 18px 0 12px; flex-wrap: wrap; }
.results-head h1 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
.results-head .sub { color: var(--muted); font-size: 14px; }
.active-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.active-chips button { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.active-chips button:hover { border-color: var(--red); color: var(--red); }

/* ============ Cards ============ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; padding-bottom: 40px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s; position: relative; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.card.is-compared { outline: 2px solid var(--brand-2); outline-offset: -1px; }
.card.is-disliked { opacity: .55; }
.card-media { position: relative; aspect-ratio: 16 / 11; background: linear-gradient(135deg, #cbd5e1, #94a3b8); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s, opacity .3s; }
.card:hover .card-media img { transform: scale(1.04); }
.media-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: #111; display: grid; place-items: center; opacity: 0; transition: opacity .2s; font-size: 16px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.media-nav.prev { left: 8px; } .media-nav.next { right: 8px; }
.card:hover .media-nav { opacity: 1; }
.photo-count { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; }
.badges { position: absolute; left: 10px; top: 10px; display: flex; flex-wrap: wrap; gap: 5px; max-width: calc(100% - 60px); }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: #fff; color: #111; box-shadow: 0 1px 3px rgba(0,0,0,.15); white-space: nowrap; }
.b-drop { background: #dcfce7; color: #166534; }
.b-up { background: #fee2e2; color: #991b1b; }
.b-new { background: #fef3c7; color: #92400e; }
.b-build { background: #dbeafe; color: #1e40af; }
.b-back { background: #ede9fe; color: #5b21b6; }
.b-value { background: #111827; color: #fff; }
.b-oh { background: #2563eb; color: #fff; }
.card-fav { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.95); display: grid; place-items: center; font-size: 18px; color: #111; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.card-fav.on { color: #e11d48; }

.card-body { padding: 14px 16px 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.price-row { display: flex; align-items: baseline; gap: 8px; }
.price { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.price small { font-size: 13px; font-weight: 500; color: var(--muted); }
.was { font-size: 13px; color: var(--muted); text-decoration: line-through; }
.type { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.addr { font-weight: 600; color: var(--ink-2); margin-top: 4px; }
.city { font-size: 14px; color: var(--muted); }
.facts { display: flex; gap: 14px; margin-top: 8px; font-size: 14px; color: var(--ink-2); flex-wrap: wrap; }
.facts b { color: var(--ink); }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--line); margin-top: 12px; font-size: 12px; color: var(--muted); }
.card-actions { display: flex; gap: 4px; align-items: center; }
.link-btn { background: none; border: 0; color: var(--brand-2); font-weight: 700; font-size: 12px; padding: 4px 6px; border-radius: 6px; }
.link-btn:hover { background: var(--brand-soft); }
.mini-btn { background: none; border: 0; font-size: 15px; padding: 4px 6px; border-radius: 6px; color: var(--muted); }
.mini-btn:hover { background: var(--bg); }
.mini-btn.on { color: var(--ink); }
.ppsf { font-weight: 700; color: var(--ink-2); }

/* List view */
.grid.list { grid-template-columns: 1fr; gap: 14px; }
.grid.list .card { flex-direction: row; }
.grid.list .card-media { width: 340px; flex-shrink: 0; aspect-ratio: auto; min-height: 220px; }
.grid.list .card-body { padding: 18px 22px; }
.grid.list .desc-snippet { display: -webkit-box; }
.desc-snippet { display: none; color: var(--muted); font-size: 14px; margin-top: 8px; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-extra { display: none; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.grid.list .list-extra { display: flex; }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--ink-2); font-weight: 500; }

/* Map view */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 0; height: calc(100vh - var(--header-h) - 61px); }
.map-layout #map { height: 100%; z-index: 1; }
.map-side { overflow-y: auto; border-left: 1px solid var(--line); background: var(--bg); padding: 14px; }
.map-side .grid { grid-template-columns: 1fr; gap: 12px; padding: 0; }
.map-side .card { flex-direction: row; }
.map-side .card-media { width: 150px; flex-shrink: 0; aspect-ratio: auto; min-height: 130px; }
.map-side .card-body { padding: 10px 44px 10px 12px; }
.map-side .facts { gap: 10px; }
.map-side .price { font-size: 19px; }
.map-side .card-foot, .map-side .card-fav, .map-side .media-nav { display: none; }
.map-side .card.hl { outline: 2px solid var(--brand-2); }
.price-pin { background: var(--card); color: var(--ink); border: 1px solid var(--line); font-weight: 800; font-size: 12px; padding: 4px 8px; border-radius: 99px; box-shadow: 0 2px 6px rgba(0,0,0,.25); white-space: nowrap; transform: translate(-50%, -50%); display: inline-block; transition: transform .15s; }
.price-pin.fav { background: #e11d48; color: #fff; border-color: #e11d48; }
.price-pin.hl, .price-pin:hover { background: var(--brand-2); color: #fff; border-color: var(--brand-2); transform: translate(-50%, -50%) scale(1.12); z-index: 999; }
.leaflet-popup-content { margin: 0 !important; width: 240px !important; }
.leaflet-popup-content-wrapper { padding: 0 !important; overflow: hidden; border-radius: 12px !important; }
.pop img { width: 100%; height: 130px; object-fit: cover; }
.pop div { padding: 10px 12px; font-size: 13px; color: #111; }
.pop b { font-size: 17px; }
.map-toggle-mobile { display: none; }
.cluster-pin { display: inline-block; transform: translate(-50%, -50%); white-space: nowrap; background: var(--brand-2); color: #fff; font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: 99px; box-shadow: 0 3px 10px rgba(37,99,235,.45); border: 2px solid #fff; cursor: pointer; }
.cluster-pin b { font-size: 13px; }
.locate-btn { display: none; }
.map-side .locate-btn { display: grid; place-items: center; position: absolute; right: 8px; bottom: 8px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 15px; z-index: 2; }
.map-side .locate-btn:hover { border-color: var(--brand-2); }
.compare-tray:not(.show) { visibility: hidden; }

.load-more { display: flex; justify-content: center; padding: 6px 0 40px; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 42px; }

/* ============ Compare tray ============ */
.compare-tray { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(140%); z-index: 60; background: var(--ink); color: var(--card); border-radius: 14px; padding: 10px 12px 10px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.3); transition: transform .25s; }
.compare-tray.show { transform: translateX(-50%) translateY(0); }
.compare-tray .thumbs { display: flex; gap: 6px; }
.compare-tray .thumbs img, .compare-tray .thumbs span { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: #475569; }
.compare-tray .btn-primary { padding: 8px 14px; }
.compare-tray .clear { background: none; border: 0; color: #94a3b8; font-size: 13px; }

/* ============ Toast ============ */
.toast { position: fixed; top: 80px; left: 50%; transform: translateX(-50%) translateY(-20px); background: var(--ink); color: var(--card); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 200; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Detail page ============ */
.detail-bar { position: sticky; top: var(--header-h); z-index: 40; background: var(--card); border-bottom: 1px solid var(--line); }
.detail-bar .container { display: flex; align-items: center; gap: 10px; height: 58px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink-2); padding: 6px 10px; border-radius: 8px; }
.back-link:hover { background: var(--bg); }
.tabs { display: flex; gap: 2px; margin-left: 10px; height: 100%; }
.tabs a { display: flex; align-items: center; padding: 0 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; font-size: 14px; }
.tabs a.active, .tabs a:hover { color: var(--brand-2); border-bottom-color: var(--brand-2); }
.pager { margin-left: auto; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.bar-actions { display: flex; gap: 6px; }

.gallery { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; height: 520px; margin-top: 18px; border-radius: var(--radius); overflow: hidden; position: relative; }
.gallery .g { position: relative; background: #cbd5e1; overflow: hidden; cursor: zoom-in; }
.gallery .g img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.gallery .g:hover img { transform: scale(1.03); }
.gallery .g0 { grid-row: span 2; }
.gallery .all-photos { position: absolute; right: 14px; bottom: 14px; }
.gallery.n1 { grid-template-columns: 1fr; } .gallery.n1 .g0 { grid-row: span 2; }
.gallery .no-photo { grid-column: 1 / -1; grid-row: 1 / -1; display: grid; place-items: center; color: #475569; font-weight: 600; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; padding: 24px 0 60px; }
.d-title { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.d-title h1 { font-size: 26px; line-height: 1.25; margin: 6px 0 4px; letter-spacing: -.02em; }
.d-title .city { font-size: 16px; }
.d-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.d-badges .badge { box-shadow: none; border: 1px solid var(--line); }
.keyfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 22px 0; }
.kf { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.kf .k { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kf .v { font-size: 20px; font-weight: 800; margin-top: 2px; letter-spacing: -.01em; }
.kf .ico { font-size: 18px; }
.section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; scroll-margin-top: 140px; }
.section h2 { font-size: 19px; margin: 0 0 14px; letter-spacing: -.01em; }
.desc { color: var(--ink-2); white-space: pre-line; }
.desc.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 24px; }
.feat { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feat span:first-child { color: var(--muted); }
.feat span:last-child { font-weight: 600; text-align: right; }
.acc { border-top: 1px solid var(--line); }
.acc:first-of-type { border-top: 0; }
.acc summary { list-style: none; display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding: 14px 0; font-weight: 700; font-size: 16px; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after { content: "+"; font-size: 22px; color: var(--muted); font-weight: 400; }
.acc[open] summary::after { content: "–"; }
.acc .acc-body { padding-bottom: 14px; }
.acc .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.hist { width: 100%; border-collapse: collapse; font-size: 14px; }
.hist th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.hist td { padding: 10px 6px; border-bottom: 1px solid var(--line); }
#dmap { height: 340px; border-radius: 12px; z-index: 1; }

.side-card { position: sticky; top: 140px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.side-card .status { color: var(--green); font-weight: 700; font-size: 13px; }
.side-card .status::before { content: "●"; margin-right: 6px; }
.side-card .price { font-size: 32px; }
.change { font-size: 14px; margin: 4px 0 2px; }
.change.down { color: var(--green); } .change.up { color: var(--red); }
.side-rows { margin: 16px 0; display: grid; gap: 8px; font-size: 14px; }
.side-rows div { display: flex; justify-content: space-between; }
.side-rows span:first-child { color: var(--muted); }
.side-rows span:last-child { font-weight: 600; }
.side-card .btn { width: 100%; margin-top: 8px; }
.note-box textarea { width: 100%; min-height: 90px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); resize: vertical; }
.courtesy { font-size: 12px; color: var(--muted); margin-top: 14px; }

.similar { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.similar .card-body { padding: 10px 12px; }
.similar .price { font-size: 19px; }
.similar .card-foot, .similar .media-nav, .similar .card-fav { display: none; }

.mobile-bar { display: none; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(5,8,15,.96); z-index: 300; display: none; flex-direction: column; color: #fff; }
.lightbox.open { display: flex; }
.lb-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.lb-top button { background: rgba(255,255,255,.1); border: 0; color: #fff; width: 42px; height: 42px; border-radius: 50%; font-size: 20px; }
.lb-stage { flex: 1; position: relative; display: grid; place-items: center; overflow: hidden; touch-action: pan-y; }
.lb-stage img { max-width: 94vw; max-height: 78vh; object-fit: contain; border-radius: 6px; user-select: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); border: 0; color: #fff; width: 52px; height: 52px; border-radius: 50%; font-size: 24px; }
.lb-nav:hover { background: rgba(255,255,255,.25); }
.lb-nav.prev { left: 16px; } .lb-nav.next { right: 16px; }
.lb-strip { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px 16px; scrollbar-width: thin; }
.lb-strip img { width: 84px; height: 60px; object-fit: cover; border-radius: 6px; opacity: .5; cursor: pointer; flex-shrink: 0; border: 2px solid transparent; }
.lb-strip img.active { opacity: 1; border-color: #fff; }

/* Compare page */
.cmp-wrap { overflow-x: auto; padding: 24px 0 60px; }
.cmp-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 720px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cmp-table th, .cmp-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
.cmp-table th { color: var(--muted); font-weight: 600; width: 170px; background: var(--bg); }
.cmp-table td.best { color: var(--green); font-weight: 800; }
.cmp-table img { width: 100%; height: 160px; object-fit: cover; border-radius: 10px; }
.cmp-table .remove { margin-top: 8px; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 26px 0 90px; color: var(--muted); font-size: 12px; background: var(--card); }

/* ============ Responsive ============ */
@media (max-width: 1024px) {
  .detail-grid { grid-template-columns: 1fr; }
  .side-card { position: static; }
  .map-layout { grid-template-columns: 1fr 340px; }
  .gallery { height: 420px; }
}
@media (max-width: 760px) {
  :root { --header-h: 56px; }
  .nav { display: none; }
  .logo-img { height: 30px; }
  .hero { padding: 14px; gap: 12px; }
  .hero img { width: 60px; height: 60px; }
  .hero h2 { font-size: 19px; }
  .hero p { font-size: 13px; }
  .hero .btn { display: none; }
  .logo span.txt { font-size: 17px; }
  .toolbar .container { gap: 8px; }
  .search { flex-basis: 100%; }
  .toolbar .chip-select.hide-m { display: none; }
  .views button span { display: none; }
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .grid.list .card { flex-direction: column; }
  .grid.list .card-media { width: 100%; min-height: 0; aspect-ratio: 16/11; }
  .media-nav { opacity: 1; width: 28px; height: 28px; }
  .map-layout { grid-template-columns: 1fr; height: calc(100vh - var(--header-h) - 110px); position: relative; }
  .map-side { position: absolute; left: 0; right: 0; bottom: 0; max-height: 44%; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; z-index: 5; box-shadow: 0 -6px 20px rgba(0,0,0,.15); }
  .map-side .card-media { width: 120px; min-height: 110px; }
  .compare-tray { left: 12px; right: 12px; transform: translateY(160%); bottom: 14px; justify-content: space-between; }
  body.has-mbar .compare-tray { bottom: 84px; }
  .compare-tray.show { transform: translateY(0); }
  .compare-tray .thumbs { display: none; }

  .detail-bar .container { height: 52px; }
  .tabs { display: none; }
  .gallery { display: block; height: auto; border-radius: 0; margin: 0 -16px; }
  .gallery .g { display: none; aspect-ratio: 4/3; }
  .gallery .g0 { display: block; }
  .gallery .all-photos { right: 12px; bottom: 12px; }
  .d-title h1 { font-size: 21px; }
  .keyfacts { grid-template-columns: repeat(2, 1fr); }
  .section { padding: 16px; border-radius: 12px; }
  .detail-grid { padding-bottom: 100px; gap: 18px; }
  .mobile-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: var(--card); border-top: 1px solid var(--line); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); gap: 8px; box-shadow: 0 -6px 20px rgba(0,0,0,.08); }
  .mobile-bar .who { flex: 1; min-width: 0; }
  .mobile-bar .who b { display: block; font-size: 18px; }
  .mobile-bar .who span { font-size: 12px; color: var(--muted); }
  .mobile-bar .btn { padding: 10px 12px; }
  .lb-nav { display: none; }
  .bar-actions .hide-m { display: none; }
}

/* Print brochure */
@media print {
  .header, .detail-bar, .mobile-bar, .side-card .btn, .note-box, .similar-section, .footer, .compare-tray, #dmap, .all-photos { display: none !important; }
  body { background: #fff; color: #000; font-size: 12px; }
  .detail-grid { grid-template-columns: 1fr 260px; gap: 18px; padding: 0; }
  .gallery { height: 300px; }
  .section { break-inside: avoid; border: 0; padding: 8px 0; }
  .desc.clamp { -webkit-line-clamp: unset; display: block; }
  .acc:not([open]) .acc-body { display: block; }
  .side-card { box-shadow: none; position: static; }
}

/* Listings without photos yet */
.noimg { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, #eef2f7, #dbe3ee); color: #475569; text-align: center; }
.noimg .ni-ico, .no-photo .ni-ico { font-size: 30px; line-height: 1; }
.noimg .ni-t { font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.gallery .no-photo { font-size: 18px; background: linear-gradient(135deg, #eef2f7, #dbe3ee); border-radius: 14px; min-height: 260px; }
:root[data-theme="dark"] .noimg { background: linear-gradient(135deg, #1f2937, #111827); color: #9ca3af; }

/* Phone in header / footer */
.hdr-phone { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.hdr-phone:hover { border-color: var(--brand-2); color: var(--brand-2); }
@media (max-width: 640px) { .hdr-phone { width: 38px; padding: 0; justify-content: center; } .hdr-phone span { display: none; } }
.foot-contact { margin-bottom: 8px; font-weight: 600; color: var(--ink-2); }
.foot-contact a { color: var(--brand-2); }
.mobile-bar .mb-call { padding: 10px 14px; }
