:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #f1ece3;
  --ink: #1f1b16;
  --ink-2: #5d554a;
  --line: #e2dbcf;
  --accent: #7a4b2a;
  --accent-ink: #ffffff;
  --sale: #c8962e;
  --sale-ink: #231a07;
  --conac: #a2542b;
  --castel: #5b4b8a;
  --cula: #2f7d5b;
  --palat: #2a6f97;
  --domeniu: #6b7a3a;
  --shadow: 0 1px 2px rgba(31, 27, 22, .06), 0 4px 16px rgba(31, 27, 22, .08);
  --radius: 12px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15130f; --surface: #1e1b16; --surface-2: #27231c; --ink: #f1ebe0; --ink-2: #b3a99a;
    --line: #363027; --accent: #d39a6a; --accent-ink: #1a120b; --sale: #e0b04d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15130f; --surface: #1e1b16; --surface-2: #27231c; --ink: #f1ebe0; --ink-2: #b3a99a;
  --line: #363027; --accent: #d39a6a; --accent-ink: #1a120b; --sale: #e0b04d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.35); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); display: flex; flex-direction: column; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.muted { color: var(--ink-2); }
[hidden] { display: none !important; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: relative; z-index: 1001; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-size: 18px; }
.brand-name { font: 650 20px/1 var(--serif); letter-spacing: .2px; }
.search { flex: 1; max-width: 560px; }
.search input { width: 100%; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); outline: none; }
.search input:focus { border-color: var(--accent); }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 999px;
  cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn-ghost.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn-ghost.has-filters:not(.active) { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang button { border: 0; background: transparent; padding: 7px 11px; cursor: pointer; font-weight: 600; font-size: 12px; }
.lang button.on { background: var(--ink); color: var(--surface); }

/* filters */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 18px; padding: 12px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 1000; }
.fgroup { display: flex; flex-direction: column; gap: 5px; }
.flabel { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 600; }
.filters select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); min-width: 130px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--bg); padding: 6px 11px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.toggles { flex-direction: row; gap: 14px; align-items: center; padding-bottom: 6px; }
.toggles label { display: flex; gap: 6px; align-items: center; cursor: pointer; }

/* layout */
.layout { flex: 1; display: grid; grid-template-columns: 1fr 440px; min-height: 0; }
.map { min-height: 0; background: var(--surface-2); }
.results { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--bg); }
.results-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 16px 8px; }
.results-head h1 { font: 650 20px/1.2 var(--serif); margin: 0 0 2px; }
.results-head p { margin: 0; font-size: 12.5px; }
.results-head select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.cards { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 16px 16px; display: grid; grid-template-columns: 1fr 1fr;
  grid-auto-rows: max-content; gap: 12px; align-content: start; }
.more { margin: 0 16px 16px; flex: none; }
.empty { grid-column: 1 / -1; padding: 30px 8px; text-align: center; color: var(--ink-2); }

/* card */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; border: 2px solid transparent; transition: transform .12s ease, border-color .12s; }
.card:hover, .card.hl { border-color: var(--accent); transform: translateY(-1px); }
.card-img { aspect-ratio: 4 / 3; background: var(--surface-2) center / cover no-repeat; position: relative; }
.card-img > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-img .ph { position: absolute; inset: 0; display: grid; place-items: center; font: 500 34px var(--serif); color: var(--ink-2); opacity: .45; }
.badge { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.pill { font-size: 10.5px; font-weight: 600; padding: 3px 7px; border-radius: 999px; background: rgba(255,255,255,.92); color: #1f1b16; }
.pill.sale { background: var(--sale); color: var(--sale-ink); }
.pill.full { background: #1f1b16; color: #fff; }
.card-body { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 3px; }
.card-price { font-weight: 650; font-size: 15px; }
.card-name { font: 500 14.5px/1.25 var(--serif); }
.card-meta { font-size: 12px; color: var(--ink-2); }
.card-facts { font-size: 12px; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; }
.kind-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }

/* markers */
.mk { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.mk.full { width: 18px; height: 18px; outline: 2px solid rgba(0,0,0,.55); outline-offset: 1px; }
.mk.village { opacity: .6; border-style: dashed; }
.mk.hl, .mk-price.hl { transform: scale(1.35); z-index: 1000; }
.mk-price { background: var(--sale); color: var(--sale-ink); font-weight: 700; font-size: 11.5px; padding: 3px 7px;
  border-radius: 999px; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.4); border: 1.5px solid #fff;
  transform-origin: center; display: inline-block; }
.marker-cluster-custom { background: rgba(122, 75, 42, .22); border-radius: 50%; }
.marker-cluster-custom div { background: var(--accent); color: var(--accent-ink); width: 30px; height: 30px; margin: 5px;
  border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.leaflet-container { font: inherit; }
.leaflet-control-layers { border-radius: 10px !important; }

/* detail */
.detail-backdrop { position: fixed; inset: 0; background: rgba(15, 12, 8, .45); z-index: 1500; }
.detail { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--surface); z-index: 1600;
  overflow-y: auto; box-shadow: -8px 0 30px rgba(0,0,0,.25); }
.d-hero { aspect-ratio: 16 / 8; background: var(--surface-2) center / cover no-repeat; position: relative; }
.d-hero.noimg { aspect-ratio: auto; height: 60px; }
.d-hero .credit { position: absolute; right: 8px; bottom: 6px; font-size: 10.5px; color: #fff; text-shadow: 0 1px 2px #000; max-width: 70%; text-align: right; }
.d-hero .credit a { color: #fff; }
.d-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.95); color: #1f1b16; font-size: 20px; line-height: 1; box-shadow: var(--shadow); }
.d-body { padding: 18px 24px 40px; }
.d-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tag { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.tag.sale { background: var(--sale); color: var(--sale-ink); }
.tag.full { background: var(--ink); color: var(--surface); }
.d-title { font: 650 28px/1.15 var(--serif); margin: 0 0 4px; }
.d-sub { color: var(--ink-2); margin: 0 0 14px; }
.d-price { font: 650 26px/1.2 var(--sans); margin: 4px 0 2px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 16px 0; }
.fact { background: var(--surface); padding: 10px 12px; }
.fact .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); font-weight: 600; }
.fact .v { margin-top: 2px; font-weight: 500; }
.fact .v small { font-weight: 400; color: var(--ink-2); }
.src { font-size: 11px; text-decoration: none; margin-left: 4px; vertical-align: 1px; }
.est { font-size: 10.5px; font-weight: 600; color: var(--sale-ink); background: color-mix(in srgb, var(--sale) 45%, transparent);
  padding: 1px 5px; border-radius: 4px; margin-left: 4px; }
.d-section { margin-top: 22px; }
.d-section h3 { font: 650 17px/1.3 var(--serif); margin: 0 0 8px; }
.d-section p { margin: 0 0 8px; }
.salebox { border: 1.5px solid var(--sale); border-radius: 12px; padding: 14px 16px; background: color-mix(in srgb, var(--sale) 10%, var(--surface)); }
.salebox .row { display: flex; gap: 16px; flex-wrap: wrap; color: var(--ink-2); font-size: 13px; margin: 4px 0 8px; }
.tx { width: 100%; border-collapse: collapse; font-size: 13px; }
.tx th, .tx td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tx th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.tx td.num { white-space: nowrap; font-weight: 600; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a { font-size: 13px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); }
.links a:hover { border-color: var(--accent); }
.comp { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; }
.note { font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); padding: 10px 12px; border-radius: 8px; }
.gallery { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; }
.gallery img { height: 84px; border-radius: 6px; }

/* phone / narrow */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 52vh auto; overflow-y: auto; }
  .results { border-left: 0; border-top: 1px solid var(--line); }
  .cards { overflow: visible; grid-template-columns: 1fr 1fr; }
  body { overflow: hidden; }
  .layout { height: 100%; }
}
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .brand-name { font-size: 18px; }
  .topbar .btn { margin-left: auto; }
  .cards { grid-template-columns: 1fr; padding: 4px 16px 16px; }
  .card-img { aspect-ratio: 16 / 9; }
  .d-body { padding: 16px 16px 40px; }
  .d-title { font-size: 23px; }
  .filters { padding: 12px 16px; gap: 10px 12px; }
  .filters select { min-width: 0; width: 100%; }
  .fgroup { flex: 1 1 140px; }
}
a.card { text-decoration: none; color: inherit; }
