:root {
  --bg: #0d1412;
  --bg-2: #15201d;
  --card: #f3eee6;
  --cream: #efe8dd;
  --muted: rgba(239, 232, 221, .62);
  --ink: #1a1714;
  --ink-2: #6a6157;
  --gold: #c9a27a;
  --gold-2: #a8835c;
  --available: #3e9a62;
  --sold: #b8473b;
  --blocked: #4f74b8;
  --match: #f0b44f;
  --line: rgba(239, 232, 221, .14);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Manrope", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--cream); font: 14px/1.5 var(--sans); overflow: hidden; }
button { font: inherit; cursor: pointer; color: inherit; }
h1, h2 { font-family: var(--serif); font-weight: 500; margin: 0; line-height: 1; }
.eyebrow { margin: 0 0 4px; font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.fine { font-size: 11px; color: var(--ink-2); margin: 0; }
.app { position: relative; height: 100%; display: flex; flex-direction: column; }

/* Barra */
.bar { display: flex; align-items: center; gap: 18px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.logo { height: 38px; width: auto; }
.titles h1 { font-size: 30px; text-transform: uppercase; letter-spacing: .02em; }
.tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search input { background: var(--bg-2); border: 1px solid var(--line); color: var(--cream); border-radius: 999px; padding: 8px 14px; width: 170px; font: inherit; font-size: 13px; }
.search input::placeholder { color: var(--muted); }
.chips, .cur { display: flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.chips button, .cur button { border: 0; background: none; padding: 5px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.chips button.on, .cur button.on { background: var(--gold); color: var(--ink); }
.cur button[hidden] { display: none; }
.chip-budget { border: 1px solid var(--gold); background: none; color: var(--gold); border-radius: 999px; padding: 6px 14px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.chip-budget.on { background: var(--match); border-color: var(--match); color: var(--ink); }

.budget { display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--bg-2); border-bottom: 1px solid var(--line); flex-wrap: wrap; font-size: 13px; }
.budget[hidden] { display: none; }
.budget input { flex: 1; min-width: 160px; accent-color: var(--match); }
.budget output { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--match); min-width: 130px; }
.budget-n b { color: var(--match); }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 12px; }

/* Plano */
.stage { position: relative; flex: 1; min-height: 0; margin: 14px 20px 20px; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); background: #0a0f0d; }
.map { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.map.dragging { cursor: grabbing; }
.map-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.map-inner img { display: block; width: 100%; height: 100%; user-select: none; }
.map-inner svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.lot { fill-opacity: .62; stroke: rgba(255,255,255,.75); stroke-width: 2; cursor: pointer; transition: fill-opacity .2s, fill .2s; }
.lot.available { fill: var(--available); }
.lot.sold { fill: var(--sold); }
.lot.blocked, .lot.unavailable { fill: var(--blocked); }
.lot.match { fill: var(--match); fill-opacity: .8; }
.lot.dim { fill-opacity: .12; stroke-opacity: .25; }
.lot:hover, .lot.sel { fill-opacity: .92; stroke: #fff; stroke-width: 5; }
.pin circle { fill: #fff; stroke: rgba(0,0,0,.25); stroke-width: 1; }
.pin text { font: 700 19px var(--sans); fill: #111; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.pin { pointer-events: none; }
.pin.dim { opacity: .3; }
.scene3d { position: absolute; inset: 0; }
.scene3d[hidden] { display: none; }

.stage-nav { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; pointer-events: none; }
.stage-nav > * { pointer-events: auto; }
.pill-btn { background: rgba(13,20,18,.82); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; backdrop-filter: blur(6px); white-space: nowrap; }
.pill-btn[disabled] { visibility: hidden; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.tabs button { background: rgba(13,20,18,.7); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 11px; font-weight: 600; backdrop-filter: blur(6px); }
.tabs button small { color: var(--available); font-weight: 700; margin-left: 4px; }
.tabs button.on { background: var(--cream); color: var(--ink); }
.tabs button.on small { color: var(--available); }

.view { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 6px; }
.view button, .zoom button { background: rgba(13,20,18,.82); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 12px; font-weight: 700; backdrop-filter: blur(6px); }
.view button.on { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.view button[hidden] { display: none; }
.zoom { position: absolute; left: 14px; bottom: 54px; display: flex; flex-direction: column; gap: 6px; }
.zoom button { width: 34px; height: 34px; padding: 0; font-size: 18px; }
.legend { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 12px; background: rgba(13,20,18,.82); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 11px; backdrop-filter: blur(6px); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.legend [hidden] { display: none; }
.s-available { background: var(--available); } .s-sold { background: var(--sold); } .s-blocked { background: var(--blocked); } .s-match { background: var(--match); }

.tip { position: absolute; z-index: 5; pointer-events: none; background: rgba(13,20,18,.94); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; min-width: 190px; font-size: 12px; transform: translate(-50%, calc(-100% - 16px)); backdrop-filter: blur(6px); }
.tip h3 { font-family: var(--serif); font-size: 20px; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.tip dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; }
.tip dt { color: var(--muted); } .tip dd { margin: 0; text-align: right; font-weight: 700; }
.tip dd.money { color: var(--match); }
.loading { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 22px; background: #0a0f0d; transition: opacity .35s; }
.loading.done { opacity: 0; pointer-events: none; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; border-radius: 999px; padding: 3px 9px; color: #fff; background: var(--available); }
.status.sold { background: var(--sold); } .status.blocked, .status.unavailable { background: var(--blocked); }

/* Panel del lote */
.panel { position: absolute; z-index: 20; top: 0; right: 0; bottom: 0; width: 380px; background: var(--card); color: var(--ink); padding: 26px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; transform: translateX(105%); transition: transform .35s cubic-bezier(.2,.8,.2,1); box-shadow: -20px 0 50px rgba(0,0,0,.35); }
.panel.open { transform: none; }
.panel h2 { font-size: 40px; }
.panel .x { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); background: #fff; font-size: 18px; color: var(--ink); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.facts div, .sim { background: #fff; border-radius: 14px; padding: 12px; }
.facts .wide { grid-column: 1 / -1; }
.facts small, .total small { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.facts b { font-size: 15px; }
.total { background: var(--bg); color: var(--cream); border-radius: 16px; padding: 14px 16px; }
.total small { color: var(--gold); }
.total b { display: block; font-family: var(--serif); font-size: 34px; font-weight: 500; }
.total span { font-size: 12px; color: var(--muted); }
.sim { display: flex; flex-direction: column; gap: 8px; }
.sim-t { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-2); }
.sim-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.sim-row b { font-size: 14px; }
.sim-row.hl { background: var(--bg); color: var(--cream); border-radius: 10px; padding: 9px 12px; }
.sim-row.hl b { color: var(--match); font-size: 18px; }
.sim-row.sm { font-size: 12px; color: var(--ink-2); }
.sim-row.sm b { font-size: 12px; color: var(--ink); }
.sim input { accent-color: var(--gold-2); width: 100%; }
.plazos { display: flex; gap: 6px; }
.plazos button { flex: 1; border: 1px solid rgba(0,0,0,.12); background: #f6f2ec; border-radius: 8px; padding: 6px 4px; font-size: 11px; font-weight: 700; color: var(--ink); }
.plazos button.on { background: var(--gold-2); color: #fff; border-color: var(--gold-2); }
.media { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.media:empty { display: none; }
.media button { position: relative; border: 0; padding: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 4/3; background: #ddd; }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media span { position: absolute; left: 6px; bottom: 6px; background: rgba(13,20,18,.85); color: var(--cream); border-radius: 999px; padding: 2px 8px; font-size: 10px; font-weight: 700; }
.cta { border: 0; background: var(--gold-2); color: #fff; border-radius: 999px; padding: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 12px; width: 100%; }
.cta:hover { background: #8e6c47; }
.cta[hidden] { display: none; }
.lead { display: flex; flex-direction: column; gap: 8px; }
.lead[hidden] { display: none; }
.lead input { font: inherit; padding: 11px 13px; border-radius: 10px; border: 1px solid rgba(0,0,0,.14); background: #fff; color: var(--ink); }

.lightbox { position: absolute; inset: 0; z-index: 30; background: rgba(5,8,7,.94); display: grid; place-items: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92%; max-height: 82%; border-radius: 12px; }
.lightbox .x { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: #fff; color: var(--ink); font-size: 20px; }
.lb-nav { position: absolute; bottom: 18px; display: flex; gap: 14px; align-items: center; font-size: 12px; }
.lb-nav button { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: none; font-size: 20px; }

@media (max-width: 760px) {
  .bar { padding: 10px 12px; gap: 10px; }
  .logo { height: 30px; }
  .titles h1 { font-size: 22px; }
  .tools { margin-left: 0; width: 100%; }
  .search input { width: 120px; }
  .stage { margin: 8px; border-radius: 16px; }
  .stage-nav .tabs { display: none; }
  .legend { bottom: 54px; }
  .zoom { bottom: 94px; }
  .panel { top: auto; left: 0; width: 100%; max-height: 86%; border-radius: 20px 20px 0 0; transform: translateY(105%); }
}
