:root {
  --accent: #0f766e;
  --accent-dark: color-mix(in srgb, var(--accent) 80%, black);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, white);
  --bg: #f6f7f9;
  --card: #fff;
  --text: #14181f;
  --muted: #5d6676;
  --line: #e4e7ec;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button, select, input { font: inherit; color: inherit; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.hidden { display: none !important; }

/* ---------- Encabezado ---------- */
.hero { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; padding: 28px 0 56px; }
.hero .brand { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85; font-weight: 600; }
.hero h1 { margin: 6px 0 4px; font-size: clamp(1.6rem, 5vw, 2.4rem); line-height: 1.15; letter-spacing: -.02em; }
.hero p { margin: 0; opacity: .92; max-width: 56ch; }
.demo-banner { background: #fff7e0; color: #7a5a00; border-bottom: 1px solid #f1dfa0; font-size: .85rem; padding: 8px 0; text-align: center; }

/* ---------- Filtros ---------- */
.filters { margin-top: -32px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: grid; gap: 12px; position: relative; }
.tabs { display: flex; gap: 6px; background: var(--bg); border-radius: 12px; padding: 4px; }
.tab { flex: 1; border: 0; background: transparent; padding: 10px 8px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tab[aria-pressed="true"] { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.filter-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .filter-row { grid-template-columns: repeat(4, 1fr); } .filters { grid-template-columns: 280px 1fr; align-items: end; } }
.field label { display: block; font-size: .72rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.field select, .field input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-height: 44px; }
.field select:focus, .field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.count { margin: 20px 0 12px; color: var(--muted); font-size: .9rem; }

/* ---------- Tarjetas ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); padding-bottom: 48px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; text-decoration: none; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(16, 24, 40, .14); }
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.thumb { position: relative; aspect-ratio: 4 / 3; background: linear-gradient(135deg, #dfe6ea, #eef1f4); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: #5d6676; font-size: .85rem; }
.badge { position: absolute; top: 10px; left: 10px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; padding: 5px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }
.badge.venta { background: #1d4ed8; }
.badge.arriendo { background: var(--accent); }
.card-body { padding: 14px 16px 16px; display: grid; gap: 6px; }
.price { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.price small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.loc { color: var(--muted); font-size: .92rem; }
.specs { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; font-size: .88rem; color: #2d3440; }
.specs span { display: inline-flex; align-items: center; gap: 5px; }
.specs svg, .ico { width: 17px; height: 17px; stroke: var(--accent); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.admin-note { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.empty, .error { text-align: center; padding: 56px 16px; background: var(--card); border-radius: var(--radius); color: var(--muted); }
.loading { text-align: center; padding: 56px; color: var(--muted); }

/* ---------- Detalle ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; margin: 20px 0 14px; font-weight: 600; color: var(--accent); text-decoration: none; padding: 6px 0; }
.detail { display: grid; gap: 24px; padding-bottom: 120px; }
@media (min-width: 900px) { .detail { grid-template-columns: 1.25fr 1fr; align-items: start; padding-bottom: 48px; } }
.gallery { position: relative; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.stage { position: relative; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 4 / 3; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; background: #e9edf1; }
.slide img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.nav-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); cursor: pointer; display: none; place-items: center; font-size: 1.2rem; }
.nav-btn.prev { left: 10px; } .nav-btn.next { right: 10px; }
@media (hover: hover) { .gallery:hover .nav-btn { display: grid; } }
.counter { position: absolute; right: 10px; bottom: 10px; background: rgba(0, 0, 0, .6); color: #fff; font-size: .78rem; padding: 3px 10px; border-radius: 999px; }
.thumbs { display: flex; gap: 8px; padding: 10px; overflow-x: auto; }
.thumbs button { flex: 0 0 72px; height: 54px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: #e9edf1; opacity: .75; }
.thumbs button[aria-current="true"] { border-color: var(--accent); opacity: 1; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }

.info { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: grid; gap: 16px; }
.info h2 { margin: 0; font-size: 1.15rem; }
.info .price { font-size: 1.9rem; }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kv div { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.kv dt { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kv dd { margin: 2px 0 0; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.chips li { background: var(--accent-soft); color: var(--accent-dark); font-size: .84rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.desc { white-space: pre-line; color: #2d3440; margin: 0; }
.actions { display: flex; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 18px; border-radius: 12px; border: 0; font-weight: 700; cursor: pointer; text-decoration: none; min-height: 48px; }
.btn-wa { background: #15803d; color: #fff; flex: 1; }
.btn-wa:hover { background: #166534; }
.btn-ghost { background: var(--accent-soft); color: var(--accent-dark); }
.sticky-cta { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); z-index: 20; }
.sticky-cta .actions { width: min(1120px, 100%); margin-inline: auto; }
@media (min-width: 900px) { .sticky-cta { display: none; } }
@media (max-width: 899px) { .info .actions.inline { display: none; } }

/* ---------- Visor ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); z-index: 50; display: grid; place-items: center; }
.lightbox img { max-width: 96vw; max-height: 92vh; object-fit: contain; }
.lightbox button { position: absolute; top: 14px; right: 14px; background: rgba(255, 255, 255, .15); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; }

footer { padding: 28px 0 40px; color: var(--muted); font-size: .85rem; text-align: center; border-top: 1px solid var(--line); }
@media (max-width: 899px) { footer { padding-bottom: 96px; } }

/* Accesibilidad */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tab:focus-visible, .btn:focus-visible { outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .card:hover { transition: none; transform: none; }
  .slides { scroll-behavior: auto; }
}
