:root {
  --acento: #1F4E5F; --tinta: #0f1c24; --gris: #5d6b75; --suave: #eef2f4; --borde: #e3e8eb;
  --blanco: #fff; --sombra: 0 10px 30px rgba(15, 28, 36, .16), 0 2px 6px rgba(15, 28, 36, .08);
  --radio: 16px; --verde: #22C55E; --naranja: #F59E0B; --rojo: #EF4444; --azul: #3B82F6;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe0ea; color: var(--tinta); font-family: "Plus Jakarta Sans", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--acento); }

#escena { position: fixed; inset: 0; }
#escena canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; }
#etiquetas { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.chip-u { position: absolute; left: 0; top: 0; pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 7px; border-radius: 999px; background: rgba(255,255,255,.95); box-shadow: var(--sombra); font-size: 12px; font-weight: 700; white-space: nowrap; transition: background .15s; }
.chip-u i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }
.chip-u:hover { background: var(--acento); color: #fff; }

/* ---------- Barra superior ---------- */
#barra { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: max(14px, env(safe-area-inset-top)) 16px 0; pointer-events: none; }
#barra .grupo { display: flex; gap: 8px; pointer-events: auto; }
.pildora, .redondo { pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; background: rgba(255,255,255,.96); border-radius: 999px; box-shadow: var(--sombra); font-weight: 700; font-size: 14px; transition: transform .15s, background .15s, color .15s; backdrop-filter: blur(8px); }
.pildora { padding: 0 18px 0 14px; }
.redondo { width: 44px; }
.redondo.texto { font-size: 13px; letter-spacing: .5px; }
.redondo.activo { background: var(--acento); color: #fff; }
.pildora:hover, .redondo:hover { transform: translateY(-1px); }
.pildora.buscar { min-width: 260px; justify-content: flex-start; color: var(--gris); font-weight: 600; }

#titulo-proyecto { position: fixed; top: 72px; left: 16px; z-index: 5; max-width: 340px; background: rgba(255,255,255,.94); border-radius: var(--radio); box-shadow: var(--sombra); padding: 14px 16px; display: flex; gap: 12px; align-items: center; backdrop-filter: blur(8px); }
#titulo-proyecto img { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; }
#titulo-proyecto h1 { margin: 0; font-size: 17px; line-height: 1.2; }
#titulo-proyecto p { margin: 3px 0 0; font-size: 12.5px; color: var(--gris); }
.marca { width: 44px; height: 44px; border-radius: 12px; background: var(--acento); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; }

/* ---------- Selector de pisos ---------- */
#pisos { position: fixed; right: 16px; top: 50%; transform: translateY(-50%); z-index: 6; display: flex; flex-direction: column; gap: 4px; padding: 8px; background: rgba(255,255,255,.95); border-radius: 20px; box-shadow: var(--sombra); max-height: calc(100vh - 220px); overflow-y: auto; scrollbar-width: none; }
#pisos::-webkit-scrollbar { display: none; }
#pisos .tit { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--gris); text-align: center; padding: 2px 0 4px; }
#pisos button { position: relative; min-width: 46px; height: 36px; border-radius: 12px; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 4px; }
#pisos button:hover { background: var(--suave); }
#pisos button.activo { background: var(--acento); color: #fff; }
#pisos button.sin { color: #aab4ba; }
#pisos button b { position: static; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--verde); color: #fff; font-size: 9.5px; line-height: 15px; }
#pisos button.activo b { background: #fff; color: var(--acento); }
#pisos .ext svg { width: 18px; height: 18px; }

#leyenda { position: fixed; left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 5; display: flex; gap: 6px; flex-wrap: wrap; max-width: 46vw; }
#leyenda span { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.94); padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; box-shadow: 0 4px 12px rgba(15,28,36,.1); }
#leyenda i { width: 10px; height: 10px; border-radius: 50%; }
#leyenda { transition: opacity .2s; }
body:has(#ficha.abierto) #leyenda { opacity: 0; pointer-events: none; }
#ayuda { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 4; background: rgba(15,28,36,.72); color: #fff; font-size: 12.5px; font-weight: 600; padding: 8px 14px; border-radius: 999px; pointer-events: none; transition: opacity .3s; white-space: nowrap; }
#ayuda:empty { opacity: 0; }

#tooltip { position: fixed; z-index: 30; pointer-events: none; background: var(--tinta); color: #fff; font-size: 12.5px; font-weight: 600; padding: 7px 11px; border-radius: 10px; opacity: 0; transform: translate(14px, 14px); transition: opacity .12s; white-space: nowrap; }
#tooltip.ver { opacity: 1; }
#tooltip small { display: block; font-weight: 500; opacity: .8; }

/* ---------- Menú lateral y paneles ---------- */
#menu-lateral { position: fixed; top: 0; left: 0; bottom: 0; width: 300px; z-index: 40; background: #fff; box-shadow: var(--sombra); transform: translateX(-105%); transition: transform .28s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; padding: 18px 14px; overflow-y: auto; }
#menu-lateral.abierto { transform: none; }
#menu-lateral .cab { display: flex; align-items: center; gap: 12px; padding: 4px 6px 16px; border-bottom: 1px solid var(--borde); margin-bottom: 10px; }
#menu-lateral .cab h2 { margin: 0; font-size: 16px; }
#menu-lateral .cab p { margin: 2px 0 0; font-size: 12px; color: var(--gris); }
#menu-lateral nav button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: 12px; font-weight: 600; font-size: 15px; text-align: left; }
#menu-lateral nav button:hover, #menu-lateral nav button.activo { background: var(--suave); color: var(--acento); }
#menu-lateral .pie { margin-top: auto; padding: 14px 8px 4px; font-size: 12px; color: var(--gris); border-top: 1px solid var(--borde); }
.velo { position: fixed; inset: 0; z-index: 35; background: rgba(15,28,36,.28); opacity: 0; pointer-events: none; transition: opacity .25s; }
.velo.ver { opacity: 1; pointer-events: auto; }

#panel { position: fixed; z-index: 20; top: 72px; left: 16px; bottom: 16px; width: min(440px, calc(100vw - 32px)); background: #fff; border-radius: 20px; box-shadow: var(--sombra); display: flex; flex-direction: column; transform: translateX(-110%); opacity: 0; transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .2s; }
#panel.abierto { transform: none; opacity: 1; }
.p-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 12px; }
.p-cab h2 { margin: 0; font-size: 19px; }
.p-cab small { color: var(--gris); font-weight: 600; }
.cerrar { width: 36px; height: 36px; border-radius: 50%; background: var(--suave); display: grid; place-items: center; flex: none; }
.cerrar:hover { background: var(--borde); }
.p-cuerpo { flex: 1; overflow-y: auto; padding: 4px 20px 20px; }
.p-cuerpo h3 { font-size: 14px; margin: 20px 0 8px; text-transform: uppercase; letter-spacing: .6px; color: var(--gris); }
.p-cuerpo p { line-height: 1.55; color: #33424c; font-size: 14.5px; }

.datos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.dato { background: var(--suave); border-radius: 12px; padding: 10px 12px; }
.dato small { display: block; font-size: 11px; color: var(--gris); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.dato b { font-size: 15px; }
.cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.cifras div { text-align: center; padding: 12px 6px; border-radius: 14px; border: 1px solid var(--borde); }
.cifras b { display: block; font-size: 22px; color: var(--acento); }
.cifras small { font-size: 11.5px; color: var(--gris); font-weight: 600; }

.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px; background: var(--acento); color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; transition: filter .15s; }
.boton:hover { filter: brightness(1.1); }
.boton.claro { background: var(--suave); color: var(--tinta); }
.boton.wa { background: #25D366; color: #fff; }
.boton.chico { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.botones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.botones .boton { flex: 1 1 auto; }

.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--suave); border-radius: 12px; font-weight: 600; font-size: 14px; margin-bottom: 12px; cursor: pointer; }
.interruptor input { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: #c4ced4; position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.interruptor input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.interruptor input:checked { background: var(--acento); }
.interruptor input:checked::after { transform: translateX(16px); }

.tarjetas-n { display: grid; gap: 8px; }
.tarjeta-n { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--borde); text-align: left; width: 100%; transition: border-color .15s, box-shadow .15s; }
.tarjeta-n:hover { border-color: var(--acento); box-shadow: 0 4px 14px rgba(15,28,36,.08); }
.tarjeta-n .num { width: 42px; height: 42px; border-radius: 12px; background: var(--suave); display: grid; place-items: center; font-weight: 800; color: var(--acento); flex: none; }
.tarjeta-n .info { flex: 1; min-width: 0; }
.tarjeta-n .info b { display: block; font-size: 14.5px; }
.tarjeta-n .info small { color: var(--gris); font-size: 12.5px; }
.barrita { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 6px; background: var(--suave); }
.barrita i { display: block; height: 100%; }
.disp { font-size: 12px; font-weight: 700; color: #15803d; background: #dcfce7; padding: 4px 8px; border-radius: 999px; white-space: nowrap; }
.disp.no { color: var(--gris); background: var(--suave); }

/* Filtros y resultados */
.filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.filtros label { font-size: 11.5px; font-weight: 700; color: var(--gris); text-transform: uppercase; letter-spacing: .4px; display: flex; flex-direction: column; gap: 4px; }
.filtros select, .filtros input, .form input, .form textarea { height: 40px; border: 1px solid var(--borde); border-radius: 10px; padding: 0 10px; background: #fff; font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--tinta); width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chips button { padding: 7px 12px; border-radius: 999px; background: var(--suave); font-size: 13px; font-weight: 600; }
.chips button.activo { background: var(--acento); color: #fff; }
.resumen-busq { font-size: 13px; color: var(--gris); font-weight: 600; margin: 4px 0 8px; display: flex; justify-content: space-between; align-items: center; }
.grilla-u { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grilla-u th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--gris); padding: 8px 6px; border-bottom: 1px solid var(--borde); position: sticky; top: 0; background: #fff; }
.grilla-u td { padding: 10px 6px; border-bottom: 1px solid var(--suave); }
.grilla-u tr[data-u] { cursor: pointer; }
.grilla-u tr[data-u]:hover td { background: #f6f9fa; }
.grilla-u td:last-child, .grilla-u th:last-child { text-align: right; }
.estado { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.estado i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }

.amenities { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.amenity { border: 1px solid var(--borde); border-radius: 14px; overflow: hidden; }
.amenity img { width: 100%; height: 110px; object-fit: cover; display: block; }
.amenity div { padding: 12px; }
.amenity .ico { width: 38px; height: 38px; border-radius: 11px; background: color-mix(in srgb, var(--acento) 12%, #fff); color: var(--acento); display: grid; place-items: center; margin-bottom: 8px; }
.amenity b { display: block; font-size: 14px; }
.amenity small { font-size: 12.5px; color: var(--gris); line-height: 1.4; display: block; margin-top: 3px; }

.galeria { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.galeria button { padding: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 4/3; background: var(--suave); position: relative; }
.galeria img, .galeria video { width: 100%; height: 100%; object-fit: cover; display: block; }
.galeria span { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 8px; }

.avance-total { background: var(--suave); border-radius: 16px; padding: 16px; margin-bottom: 16px; }
.avance-total b { font-size: 32px; color: var(--acento); }
.progreso { height: 10px; background: #dfe6ea; border-radius: 5px; overflow: hidden; margin-top: 8px; }
.progreso i { display: block; height: 100%; background: var(--acento); border-radius: 5px; }
.linea { border-left: 2px solid var(--borde); margin-left: 8px; padding-left: 18px; }
.hito { position: relative; padding-bottom: 18px; }
.hito::before { content: ""; position: absolute; left: -25px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--acento); box-shadow: 0 0 0 4px #fff; }
.hito small { color: var(--gris); font-weight: 600; font-size: 12px; }
.hito b { display: block; margin: 2px 0; }
.hito img { width: 100%; border-radius: 12px; margin-top: 8px; }

#mapa { height: 300px; border-radius: 16px; overflow: hidden; margin: 6px 0 12px; z-index: 0; }
.pin { background: var(--acento); color: #fff; font: 700 12px "Plus Jakarta Sans", sans-serif; padding: 6px 10px; border-radius: 999px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,.3); transform: translate(-50%, -100%); display: inline-block; position: relative; }
.pin.poi { background: #fff; color: var(--tinta); font-weight: 600; }
.pin::after { content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-top-color: inherit; border-bottom: 0; border-top-color: var(--acento); }
.pin.poi::after { border-top-color: #fff; }
.leaflet-div-icon { background: none; border: 0; }
.capas-mapa { display: flex; gap: 6px; margin-top: 4px; }
.lugares { display: grid; gap: 6px; }
.lugar { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--suave); font-size: 13.5px; align-items: center; }
.lugar small { color: var(--gris); font-weight: 600; white-space: nowrap; }

.form { display: grid; gap: 8px; }
.form textarea { height: 80px; padding: 10px; resize: vertical; }
.qr-caja { display: grid; place-items: center; background: #fff; border: 1px solid var(--borde); border-radius: 16px; padding: 14px; }
.qr-caja svg { width: 190px; height: 190px; stroke: none; }
.ok { background: #dcfce7; color: #166534; padding: 12px; border-radius: 12px; font-weight: 600; font-size: 14px; }

/* ---------- Ficha de unidad (abajo) ---------- */
#ficha { position: fixed; z-index: 15; left: 50%; bottom: 16px; width: min(560px, calc(100vw - 32px)); background: #fff; border-radius: 20px; box-shadow: var(--sombra); transform: translate(-50%, 130%); transition: transform .32s cubic-bezier(.2,.8,.2,1); display: flex; overflow: hidden; }
#ficha.abierto { transform: translate(-50%, 0); }
#ficha .foto { width: 150px; flex: none; background: var(--suave) center/cover; display: grid; place-items: center; color: var(--acento); }
#ficha .foto svg { width: 100%; height: 100%; stroke: none; }
#ficha .cuerpo { flex: 1; padding: 14px 16px; min-width: 0; }
#ficha .fila { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#ficha h3 { margin: 0; font-size: 20px; }
#ficha .sub { font-size: 12.5px; color: var(--gris); font-weight: 600; margin-top: 2px; }
#ficha .precio { font-size: 18px; font-weight: 800; margin: 8px 0 4px; }
#ficha .carac { display: flex; gap: 12px; font-size: 13px; color: #33424c; font-weight: 600; flex-wrap: wrap; }
#ficha .carac span { display: inline-flex; align-items: center; gap: 5px; }
#ficha .carac svg { width: 16px; height: 16px; color: var(--gris); }
#ficha .botones { margin-top: 10px; }
#ficha .cerrar { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; }
#ficha .cuerpo > .fila:first-child { padding-right: 34px; }
#ficha .cerrar svg { width: 16px; height: 16px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, #fff); white-space: nowrap; }
.badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

/* ---------- Detalle (modal grande) ---------- */
.capa { position: fixed; inset: 0; z-index: 50; background: rgba(15,28,36,.5); display: grid; place-items: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity .22s; }
.capa.abierto { opacity: 1; pointer-events: auto; }
.caja { background: #fff; border-radius: 22px; box-shadow: var(--sombra); width: min(980px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; transform: translateY(16px); transition: transform .25s; }
.capa.abierto .caja { transform: none; }
.caja.chica { width: min(420px, 100%); }
.d-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.d-cab h2 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.d-cab p { margin: 4px 0 0; color: var(--gris); font-size: 13.5px; font-weight: 600; }
.pestanas { display: flex; gap: 4px; padding: 14px 22px 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--borde); }
.pestanas::-webkit-scrollbar { display: none; }
.pestanas button { padding: 10px 14px; font-weight: 700; font-size: 13.5px; color: var(--gris); border-bottom: 2.5px solid transparent; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.pestanas button svg { width: 16px; height: 16px; }
.pestanas button.activo { color: var(--acento); border-bottom-color: var(--acento); }
.d-cuerpo { flex: 1; overflow-y: auto; padding: 18px 22px 22px; }
.d-dos { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.lienzo { background: var(--suave); border-radius: 16px; overflow: hidden; min-height: 340px; display: grid; place-items: center; position: relative; }
.lienzo img { max-width: 100%; max-height: 62vh; display: block; }
.lienzo svg.plano { width: 100%; height: auto; max-height: 62vh; stroke: none; }
.lienzo iframe { width: 100%; height: 62vh; border: 0; display: block; }
.visor360 { width: 100%; height: 62vh; min-height: 340px; cursor: grab; }
.visor360 canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; }
.marca-360 { position: absolute; left: 12px; top: 12px; background: rgba(15,28,36,.7); color: #fff; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; pointer-events: none; }
.tabla-sup { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla-sup td { padding: 10px 4px; border-bottom: 1px solid var(--suave); }
.tabla-sup td:last-child { text-align: right; font-weight: 700; }
.tabla-sup tr.total td { border-top: 2px solid var(--borde); font-size: 15px; }
.vacio-d { text-align: center; color: var(--gris); padding: 50px 20px; font-size: 14px; }

.comparador { position: relative; width: 100%; aspect-ratio: 16/10; border-radius: 16px; overflow: hidden; background: var(--suave); user-select: none; }
.comparador img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.comparador .arriba { clip-path: inset(0 0 0 var(--x, 50%)); }
.comparador .linea-c { position: absolute; top: 0; bottom: 0; left: var(--x, 50%); width: 3px; background: #fff; transform: translateX(-50%); pointer-events: none; }
.comparador .linea-c::after { content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 38px; height: 38px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 800; color: var(--acento); box-shadow: var(--sombra); }
.comparador input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.comparador .et { position: absolute; top: 10px; background: rgba(15,28,36,.7); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; pointer-events: none; }

.calc { display: grid; gap: 12px; }
.calc label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--gris); }
.calc label span { display: flex; justify-content: space-between; }
.calc label span b { color: var(--tinta); }
.calc input[type=range] { width: 100%; accent-color: var(--acento); }
.calc-res { background: var(--suave); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
.calc-res div { display: flex; justify-content: space-between; font-size: 14px; }
.calc-res .grande { font-size: 18px; font-weight: 800; color: var(--acento); border-top: 1px solid var(--borde); padding-top: 10px; }
.nota { font-size: 12px; color: var(--gris); margin-top: 8px; line-height: 1.45; }

/* ---------- Ficha grande de la unidad: pestañas a la izquierda, datos al costado ---------- */
.caja.grande { width: min(1200px, 100%); height: calc(100vh - 40px); }
.d-acc { display: flex; gap: 6px; align-items: center; }
.d-pos { font-size: 12.5px; font-weight: 700; color: var(--gris); min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.d-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 310px; margin-top: 12px; border-top: 1px solid var(--borde); }
.d-izq { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.d-izq .pestanas { padding-top: 6px; }
.d-lado { overflow-y: auto; border-left: 1px solid var(--borde); padding: 18px 20px 24px; background: color-mix(in srgb, var(--suave) 45%, #fff); }
.d-lado h4 { margin: 18px 0 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--gris); }
.l-precio { font-size: 26px; font-weight: 800; letter-spacing: -.3px; margin-bottom: 12px; }
.l-botones { display: grid; gap: 8px; }
.l-botones .boton { width: 100%; }
.d-lado .tabla-sup { font-size: 13.5px; }
.d-lado .tabla-sup td { padding: 7px 2px; }
.l-amb { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.l-amb li { background: #fff; border: 1px solid var(--borde); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; }
.l-piso svg { width: 100%; height: auto; max-height: 170px; stroke: none; display: block; }
.l-aviso { margin-top: 16px; font-size: 12.5px; color: var(--gris); }
.l-aviso summary { cursor: pointer; font-weight: 700; color: var(--tinta); }
.l-aviso p { line-height: 1.5; margin: 8px 0 0; }
.l-qr { margin-top: 16px; }
.l-qr svg { width: 130px; height: 130px; }
/* Vistas 3D generadas (render, plano 3D, recorrido, vista desde el piso) */
.caja3d, .int-caja { position: relative; width: 100%; height: 62vh; min-height: 340px; border-radius: 16px; overflow: hidden; background: var(--suave); }
.int-caja canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; cursor: grab; }
.vista-aviso, .vista-ayuda { position: absolute; z-index: 2; background: rgba(15,28,36,.72); color: #fff; font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: 999px; pointer-events: none; }
.vista-aviso { left: 12px; top: 12px; max-width: calc(100% - 24px); }
.vista-ayuda { left: 50%; bottom: 12px; transform: translateX(-50%); white-space: nowrap; transition: opacity .4s; }
/* Brújula y crédito de OpenStreetMap (solo con el entorno real) */
.mapa-info { position: absolute; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; }
.mapa-info[hidden] { display: none; }
.brujula { width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.95); box-shadow: var(--sombra); display: grid; place-items: center; }
.brujula svg { width: 40px; height: 40px; stroke: none; transition: transform .08s linear; }
.brujula text { font: 800 9px "Plus Jakarta Sans", sans-serif; fill: var(--tinta, #0f1c24); }
.brujula .n { fill: #e5484d; } .brujula .s { fill: #a3aeb5; }
.credito-osm { pointer-events: auto; font-size: 10.5px; color: #33424c; background: rgba(255,255,255,.82); padding: 2px 7px; border-radius: 6px; text-decoration: none; }
.int-ui { position: absolute; inset: 0; pointer-events: none; }
.int-ui button { pointer-events: auto; }
.int-chips { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; justify-content: safe center; }
.int-chips::-webkit-scrollbar { display: none; }
.int-chips button, .int-luz { flex: none; padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.93); font-size: 12.5px; font-weight: 700; box-shadow: 0 2px 10px rgba(0,0,0,.14); color: var(--tinta); }
.int-chips button.activo { background: var(--acento); color: #fff; }
.int-luz { position: absolute; top: 10px; right: 10px; }
.int-marca { position: absolute; top: 12px; left: 12px; background: rgba(15,28,36,.62); color: #fff; font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px; }
.int-ayuda { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(15,28,36,.72); color: #fff; font-size: 13px; font-weight: 700; padding: 8px 14px; border-radius: 999px; white-space: nowrap; }
/* Comparador de dos unidades */
.comp-sel { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; font-weight: 700; color: var(--gris); }
.comp-sel select { flex: 1; max-width: 380px; height: 40px; border: 1px solid var(--borde); border-radius: 10px; padding: 0 10px; background: #fff; font-size: 14px; color: var(--tinta); }
.comp-dos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.comp-col { background: var(--suave); border-radius: 16px; padding: 12px; min-width: 0; }
.comp-cab { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.comp-cab .boton { margin-left: auto; }
.comp-plano { display: grid; place-items: center; min-height: 180px; }
.comp-plano svg, .comp-plano img { width: 100%; height: auto; max-height: 300px; stroke: none; object-fit: contain; display: block; }
.tabla-comp { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 14px; }
.tabla-comp th { text-align: right; font-size: 12px; color: var(--gris); padding: 6px 4px; border-bottom: 2px solid var(--borde); }
.tabla-comp td { padding: 9px 4px; border-bottom: 1px solid var(--suave); text-align: right; font-weight: 700; }
.tabla-comp td:first-child, .tabla-comp th:first-child { text-align: left; font-weight: 600; color: var(--gris); }
.tabla-comp td.dif { color: var(--acento); white-space: nowrap; }

/* ---------- Portada ---------- */
#portada { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: linear-gradient(160deg, color-mix(in srgb, var(--acento) 92%, #000), color-mix(in srgb, var(--acento) 55%, #000)); color: #fff; text-align: center; padding: 24px; transition: opacity .6s, visibility .6s; background-size: cover; background-position: center; }
#portada.fuera { opacity: 0; visibility: hidden; }
#portada .contenido { max-width: 620px; }
#portada .logo { width: 88px; height: 88px; object-fit: contain; margin-bottom: 18px; }
#portada .etiqueta { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; padding: 6px 14px; border: 1px solid rgba(255,255,255,.4); border-radius: 999px; margin-bottom: 18px; }
#portada h1 { font-size: clamp(32px, 6vw, 58px); line-height: 1.05; margin: 0 0 12px; letter-spacing: -1px; }
#portada p { font-size: clamp(15px, 2.2vw, 19px); opacity: .88; margin: 0 0 28px; line-height: 1.45; }
#portada .boton { height: 54px; padding: 0 30px; font-size: 16px; background: #fff; color: var(--acento); border-radius: 999px; }
#portada .pie { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); left: 0; right: 0; font-size: 12.5px; opacity: .7; }
#cargando { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: #e9f0f3; transition: opacity .4s, visibility .4s; }
#cargando.fuera { opacity: 0; visibility: hidden; }
.giro { width: 42px; height: 42px; border-radius: 50%; border: 4px solid #cdd9df; border-top-color: var(--acento); animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.error-carga { max-width: 360px; text-align: center; padding: 24px; }

/* Lightbox */
.lightbox { position: relative; max-width: min(1200px, 100%); max-height: calc(100vh - 40px); }
.lightbox img, .lightbox video { max-width: 100%; max-height: calc(100vh - 80px); border-radius: 14px; display: block; }
.lightbox .cerrar { position: absolute; top: -14px; right: -14px; background: #fff; box-shadow: var(--sombra); }
.lightbox p { color: #fff; text-align: center; font-weight: 600; margin: 10px 0 0; }

#impresion { display: none; }

/* ---------- Celular ---------- */
.solo-compu { }
@media (max-width: 760px) {
  #barra { padding: max(10px, env(safe-area-inset-top)) 10px 0; gap: 6px; }
  #barra .grupo { gap: 6px; }
  .pildora, .redondo { height: 40px; font-size: 13px; }
  .redondo { width: 40px; }
  .pildora { padding: 0 13px 0 11px; }
  .pildora.buscar { min-width: 0; width: 40px; padding: 0; justify-content: center; }
  .pildora.buscar span, #b-qr, .solo-compu { display: none; }
  #titulo-proyecto { top: 60px; left: 10px; right: 70px; max-width: none; padding: 10px 12px; }
  #titulo-proyecto h1 { font-size: 15px; }
  #titulo-proyecto p { font-size: 11.5px; }
  #titulo-proyecto img, .marca { width: 36px; height: 36px; font-size: 15px; }
  #pisos { right: 10px; top: 120px; transform: none; max-height: calc(100vh - 260px); padding: 6px; border-radius: 16px; }
  #pisos button { min-width: 40px; height: 34px; font-size: 12.5px; }
  #leyenda { left: 10px; right: 10px; max-width: none; bottom: max(10px, env(safe-area-inset-bottom)); gap: 4px; }
  #leyenda span { padding: 5px 8px; font-size: 11px; }
  #ayuda { bottom: 50px; font-size: 11.5px; }
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 86vh; border-radius: 22px 22px 0 0; transform: translateY(105%); }
  #panel.abierto { transform: none; }
  .p-cab { padding: 16px 16px 10px; }
  .p-cuerpo { padding: 4px 16px 24px; }
  #ficha { left: 0; right: 0; bottom: 0; width: 100%; border-radius: 22px 22px 0 0; transform: translateY(110%); flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
  #ficha.abierto { transform: none; }
  #ficha .foto { width: 100%; height: 110px; }
  #ficha .cuerpo { padding: 12px 14px 14px; }
  #ficha .cuerpo > .fila:first-child { padding-right: 0; }
  #ficha .boton { height: 40px; padding: 0 10px; font-size: 13px; }
  .capa { padding: 0; place-items: end stretch; }
  .caja { max-height: 94vh; border-radius: 22px 22px 0 0; width: 100%; }
  .caja.chica { width: 100%; }
  .d-cab { padding: 16px 16px 0; }
  .d-cab h2 { font-size: 19px; }
  .pestanas { padding: 10px 10px 0; }
  .pestanas button { padding: 9px 10px; font-size: 13px; }
  .d-cuerpo { padding: 14px 16px 22px; }
  .d-dos { grid-template-columns: 1fr; }
  .lienzo { min-height: 240px; }
  .visor360, .lienzo iframe { height: 52vh; min-height: 260px; }
  .amenities, .galeria { grid-template-columns: 1fr 1fr; }
  .filtros { grid-template-columns: 1fr 1fr; }
  #menu-lateral { width: 84vw; }
  .caja.grande { height: 94vh; }
  .d-acc { gap: 4px; }
  .d-grid { display: block; overflow-y: auto; margin-top: 10px; }
  .d-izq .pestanas { position: sticky; top: 0; background: #fff; z-index: 2; }
  .d-lado { border-left: 0; border-top: 1px solid var(--borde); overflow: visible; padding: 16px; }
  .caja3d, .int-caja { height: 52vh; min-height: 260px; }
  .mapa-info { right: 10px; bottom: 92px; }
  .brujula { width: 40px; height: 40px; } .brujula svg { width: 34px; height: 34px; }
  .credito-osm { font-size: 9.5px; }
  .int-chips { justify-content: flex-start; }
  .comp-dos { gap: 8px; }
  .comp-col { padding: 8px; }
  .comp-plano { min-height: 110px; }
  .tabla-comp { font-size: 12.5px; }
  .lightbox .cerrar { top: 8px; right: 8px; }
  .capa:has(.lightbox) { place-items: center; padding: 10px; }
}

/* ---------- Ficha para imprimir ---------- */
@media print {
  @page { margin: 14mm; }
  html, body { overflow: visible; height: auto; background: #fff; }
  body > *:not(#impresion) { display: none !important; }
  #impresion { display: block; color: #000; font-size: 12pt; }
  #impresion .cab-i { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--acento); padding-bottom: 10px; margin-bottom: 16px; }
  #impresion h1 { margin: 0; font-size: 24pt; }
  #impresion h2 { margin: 0 0 4px; font-size: 16pt; color: var(--acento); }
  #impresion .grid-i { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
  #impresion .plano-i svg, #impresion .plano-i img { width: 100%; height: auto; max-height: 120mm; object-fit: contain; }
  #impresion table { width: 100%; border-collapse: collapse; }
  #impresion td { padding: 5px 2px; border-bottom: 1px solid #ddd; }
  #impresion td:last-child { text-align: right; font-weight: 700; }
  #impresion .qr-i svg { width: 34mm; height: 34mm; }
  #impresion .pie-i { margin-top: 18px; border-top: 1px solid #ccc; padding-top: 8px; font-size: 10pt; color: #444; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
}

/* ---------- Lista de todos los emprendimientos ---------- */
#menu-lateral a.todos { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding: 12px; border-radius: 12px; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--acento); border: 1px solid var(--borde); }
#menu-lateral a.todos:hover { background: var(--suave); }
#menu-lateral a.todos svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.modo-lista { overflow: auto; background: #eef2f4; }
body.modo-lista > :not(#lista-emprend):not(#cargando) { display: none !important; }
#lista-emprend { max-width: 1180px; margin: 0 auto; padding: 32px 16px 40px; color: var(--tinta); }
#lista-emprend header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
#lista-emprend header small { font-size: 12px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: var(--gris); }
#lista-emprend h1 { margin: 4px 0 0; font-size: clamp(28px, 5vw, 42px); letter-spacing: -.8px; line-height: 1.05; }
#lista-emprend .solo { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; background: #fff; padding: 10px 14px; border-radius: 999px; box-shadow: 0 1px 3px rgba(15,28,36,.08); cursor: pointer; }
#lista-emprend .solo input { width: 18px; height: 18px; accent-color: var(--acento); }
#lista-emprend .grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
#lista-emprend .emp { display: flex; flex-direction: column; background: #fff; border-radius: 18px; overflow: hidden; text-decoration: none; color: inherit; box-shadow: 0 2px 8px rgba(15,28,36,.07); transition: transform .2s, box-shadow .2s; }
#lista-emprend .emp:hover { transform: translateY(-3px); box-shadow: var(--sombra); }
#lista-emprend .foto { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; background: linear-gradient(150deg, var(--c), color-mix(in srgb, var(--c) 45%, #000)); background-size: cover; background-position: center; }
#lista-emprend .foto img { max-width: 40%; max-height: 46%; object-fit: contain; filter: drop-shadow(0 2px 8px rgba(0,0,0,.35)); }
#lista-emprend .foto span { font-size: 54px; font-weight: 800; color: rgba(255,255,255,.9); }
#lista-emprend .foto em { position: absolute; top: 12px; left: 12px; font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; background: rgba(255,255,255,.92); color: var(--tinta); padding: 5px 10px; border-radius: 999px; }
#lista-emprend .info { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px 18px; flex: 1; }
#lista-emprend .info h2 { margin: 0; font-size: 19px; letter-spacing: -.3px; }
#lista-emprend .info p { margin: 0; font-size: 13.5px; color: var(--gris); }
#lista-emprend .info .obra { font-weight: 600; color: var(--tinta); }
#lista-emprend .datos { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--borde); font-size: 14px; }
#lista-emprend .datos b { color: #15803d; }
#lista-emprend .datos b.nada { color: var(--gris); }
#lista-emprend .datos span { font-weight: 700; }
#lista-emprend .ir { margin-top: 12px; display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--c); color: #fff; font-weight: 700; font-size: 14px; }
#lista-emprend .ir svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#lista-emprend .vacio { color: var(--gris); }
#lista-emprend footer { margin-top: 30px; font-size: 12.5px; color: var(--gris); text-align: center; }
@media (max-width: 760px) {
  #lista-emprend { padding-top: 22px; }
  #lista-emprend .grilla { grid-template-columns: 1fr; }
}
