/* ==========================================================
   Horizonte Inmobiliaria — hoja de estilos principal
   Sin frameworks ni build step: CSS plano compatible con
   cualquier hosting compartido.
   ========================================================== */

:root {
  --background: #fbfaf7;
  --foreground: #14201f;
  --ink: #0f3d3e;
  --ink-dark: #0a2a2b;
  --gold: #c9a24b;
  --gold-light: #e4c983;
  --line: #e4e1d8;
  --paper: #ffffff;
  --muted: #6b7573;
  --radius: 16px;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--background);
  color: var(--foreground);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

h1, h2, h3, .font-display {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
input, select, textarea, button { font: inherit; color: inherit; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold);
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 0.75rem 1.5rem; font-weight: 600; font-size: 0.9rem; border: none; cursor: pointer; transition: background-color .2s ease, transform .2s ease; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-dark); }
.btn-gold { background: var(--gold); color: var(--ink-dark); }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--foreground); }
.btn-outline:hover { background: rgba(0,0,0,.03); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
.btn-danger { color: #b91c1c; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.site-header .inner { height: 80px; display: flex; align-items: center; justify-content: space-between; }
.site-logo { font-family: Georgia, serif; font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.site-nav { display: flex; gap: 1.75rem; align-items: center; }
.site-nav a { font-size: .9rem; font-weight: 500; color: rgba(20,32,31,.8); display: inline-flex; align-items: center; gap: .3rem; }
.site-nav a:hover { color: var(--ink); }
.nav-toggle {
  display: none; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-size: 1.2rem; cursor: pointer; align-items: center; justify-content: center;
}

/* Menú móvil (cajón lateral) */
.mobile-nav-overlay {
  display: none; position: fixed; inset: 0; z-index: 150; background: rgba(10,20,20,.5);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.mobile-nav-overlay.open { opacity: 1; pointer-events: auto; }
.mobile-nav {
  display: none; position: fixed; top: 0; right: 0; bottom: 0; width: 280px; max-width: 85vw;
  background: #fff; z-index: 160; padding: 1.25rem; flex-direction: column; gap: .2rem;
  transform: translateX(100%); transition: transform .25s ease; box-shadow: -20px 0 40px rgba(0,0,0,.15);
}
.mobile-nav.open { transform: translateX(0); }
.mobile-nav-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.mobile-nav a { padding: .8rem .3rem; border-bottom: 1px solid var(--line); font-size: 1rem; color: var(--foreground); display: flex; align-items: center; gap: .4rem; }

@media (max-width: 860px) {
  .site-nav { display: none; }
  .nav-toggle { display: flex; }
  .mobile-nav-overlay, .mobile-nav { display: flex; }
}

/* Footer */
.site-footer { margin-top: 5rem; background: var(--ink); color: rgba(255,255,255,.85); }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1fr 1.1fr 1fr 1fr; gap: 2.2rem; padding-top: 4rem; padding-bottom: 4rem; }
.footer-grid h3 { color: #fff; font-size: 1.4rem; }
.footer-grid .eyebrow { color: rgba(201,162,75,.9); }
.footer-grid ul { margin-top: 1rem; }
.footer-grid li { margin-bottom: .5rem; color: rgba(255,255,255,.7); font-size: .9rem; }
.footer-grid a:hover { color: #fff; }
.footer-legal-links { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 1.2rem; width: 100%; text-align: center; padding: 1rem 20px 0; border-top: 1px solid rgba(255,255,255,.1); box-sizing: border-box; }
.footer-legal-links a { font-size: .78rem; color: rgba(255,255,255,.5); }
.footer-legal-links a:hover { color: #fff; }
.footer-bottom { padding: 1.2rem 20px; text-align: center; font-size: .75rem; color: rgba(255,255,255,.4); }

.footer-featured-list { margin-top: 1rem; display: flex; flex-direction: column; gap: .9rem; }
.footer-featured-item { display: flex; gap: .7rem; align-items: center; }
.footer-featured-thumb { flex-shrink: 0; width: 52px; height: 52px; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,.1); display: block; }
.footer-featured-thumb img { width: 100%; height: 100%; object-fit: cover; }
.footer-featured-title { display: block; font-size: .84rem; color: rgba(255,255,255,.9); line-height: 1.3; }
.footer-featured-title:hover { color: var(--gold-light); }
.footer-featured-price { font-size: .8rem; color: var(--gold-light); margin-top: .2rem; font-weight: 600; }

@media (max-width: 1080px) { .footer-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

/* Hero */
.hero { position: relative; overflow: hidden; background: var(--ink); color: #fff; }
.hero-bg { position: absolute; inset: 0; opacity: .25; background-size: cover; background-position: center; }
.hero-inner { position: relative; padding-top: 6rem; padding-bottom: 8rem; }
.hero h1 { font-size: 2.75rem; max-width: 640px; margin-top: 1rem; }
@media (min-width: 768px) { .hero h1 { font-size: 3.75rem; } }
.hero p.lead { max-width: 480px; margin-top: 1.25rem; color: rgba(255,255,255,.7); }

/* Search bar */
.search-bar { display: flex; flex-wrap: wrap; gap: .75rem; background: #fff; border-radius: var(--radius); padding: .75rem; box-shadow: 0 25px 50px -12px rgba(0,0,0,.35); margin-top: 2.5rem; }
.search-bar select, .search-bar input[type=text] { border: 1px solid var(--line); border-radius: 12px; padding: .65rem .9rem; font-size: .9rem; color: var(--foreground); }
.search-bar input[type=text]::placeholder { color: var(--muted); }
.search-bar input[type=text] { flex: 1; min-width: 180px; }
.op-toggle { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.op-toggle a { padding: .65rem 1.1rem; font-size: .9rem; font-weight: 600; color: rgba(20,32,31,.7); }
.op-toggle a.active { background: var(--ink); color: #fff; }

/* Sections */
.section { padding: 5rem 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 2.5rem; }
.section-head h2 { font-size: 2rem; color: var(--ink); }

/* Property grid & cards */
.property-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 980px) { .property-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .property-grid { grid-template-columns: 1fr; } }

.property-card { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .25s ease, box-shadow .25s ease; }
.property-card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -18px rgba(15,61,62,.35); }
.property-card .thumb { position: relative; aspect-ratio: 4/3; background: var(--line); overflow: hidden; }
.property-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.property-card .badges { position: absolute; top: .75rem; left: .75rem; display: flex; gap: .4rem; }

.thumb-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.9); color: var(--ink-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; line-height: 1; cursor: pointer; z-index: 3;
  box-shadow: 0 4px 10px rgba(0,0,0,.15); user-select: none;
}
.thumb-arrow:hover { background: #fff; }
.thumb-arrow-prev { left: .6rem; }
.thumb-arrow-next { right: .6rem; }
.thumb-dots { position: absolute; bottom: .6rem; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; z-index: 3; }
.thumb-dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.6); transition: background .15s ease, width .15s ease; }
.thumb-dot.active { background: #fff; width: 14px; border-radius: 3px; }
.badge { border-radius: 999px; padding: .3rem .7rem; font-size: .7rem; font-weight: 700; }
.badge-op { background: var(--ink); color: #fff; }
.badge-featured { background: var(--gold); color: var(--ink-dark); }
.property-card .body { padding: 1.2rem; }
.property-card h3 { font-size: 1.05rem; color: var(--ink); margin-top: .2rem; }
.property-card .price { font-size: 1.25rem; font-weight: 700; color: var(--ink); margin-top: .6rem; }
.property-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.property-meta span { display: inline-flex; align-items: center; gap: .3rem; }
.meta-icon { flex-shrink: 0; opacity: .75; }

/* Value props */
.value-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; }
@media (max-width: 860px) { .value-grid { grid-template-columns: 1fr; } }
.value-item { border-top: 2px solid var(--gold); padding-top: 1.2rem; }
.value-item h3 { font-size: 1.2rem; color: var(--ink); margin-top: .5rem; }
.value-item p { color: var(--muted); font-size: .9rem; margin-top: .5rem; }

/* CTA */
.cta-box { display: flex; flex-direction: column; align-items: center; gap: 1.2rem; text-align: center; background: var(--ink); color: #fff; border-radius: 24px; padding: 3.5rem 2rem; }
.cta-box h2 { font-size: 2rem; max-width: 560px; }
.cta-box p { max-width: 460px; color: rgba(255,255,255,.7); }

/* Forms */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; color: rgba(20,32,31,.8); margin-bottom: .4rem; }
.field .hint { font-size: .75rem; color: var(--muted); margin-top: .35rem; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=date], input[type=color], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: .65rem .85rem; font-size: .9rem; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(15,61,62,.15); border-color: var(--ink); }
textarea { resize: vertical; }
.checkbox-line { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.form-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 640px) { .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; } }

.alert { border-radius: 10px; padding: .8rem 1rem; font-size: .88rem; margin-bottom: 1rem; }
.alert-success { background: #ecfdf5; color: #047857; }
.alert-error { background: #fef2f2; color: #b91c1c; }

/* Property detail */
.gallery-main { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/8; background: var(--line); margin-bottom: .6rem; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.92); color: var(--ink-dark);
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.18); z-index: 3;
}
.gallery-arrow:hover { background: #fff; }
.gallery-arrow-prev { left: 1rem; }
.gallery-arrow-next { right: 1rem; }
.gallery-counter {
  position: absolute; bottom: 1rem; right: 1rem; z-index: 3;
  background: rgba(10,20,20,.65); color: #fff; font-size: .78rem;
  padding: .3rem .75rem; border-radius: 999px;
}
.gallery-thumbs { display: grid; grid-template-columns: repeat(8, 1fr); gap: .5rem; }
.gallery-thumb-btn {
  position: relative; aspect-ratio: 1/1; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; padding: 0; cursor: pointer; background: none;
}
.gallery-thumb-btn img { width: 100%; height: 100%; object-fit: cover; opacity: .65; transition: opacity .15s ease; }
.gallery-thumb-btn:hover img { opacity: .9; }
.gallery-thumb-btn.active { border-color: var(--gold); }
.gallery-thumb-btn.active img { opacity: 1; }
@media (max-width: 640px) { .gallery-thumbs { grid-template-columns: repeat(4, 1fr); } }

.detail-grid { display: grid; grid-template-columns: 1fr 360px; gap: 2.5rem; margin-top: 2.5rem; }
@media (max-width: 980px) { .detail-grid { grid-template-columns: 1fr; } }
.stat-box { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
@media (max-width: 640px) { .stat-box { grid-template-columns: repeat(2, 1fr); } }
.stat-box .num { font-size: 1.3rem; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: .4rem; }
.stat-box .num .meta-icon { color: var(--gold); opacity: 1; }
.stat-box .lbl { font-size: .7rem; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }

.feature-chip { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem; font-size: .87rem; background: #fff; }
.feature-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--gold); }

.sidebar-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }

.agent-summary { display: flex; align-items: center; gap: .8rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.agent-photo { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.agent-photo-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 1.2rem; font-family: Georgia, serif;
}
.agent-name { font-weight: 700; color: var(--ink); font-size: .95rem; }
.agent-role { font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.agent-contact-buttons { display: flex; gap: .5rem; margin-top: .9rem; flex-wrap: wrap; }
.agent-contact-buttons .btn { flex: 1; min-width: 90px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }

/* Sección "El equipo" (Sobre nosotros) */
.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 2.5rem; }
.team-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; text-align: center; }
.team-photo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin: 0 auto; }
.team-photo-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 1.8rem; font-family: Georgia, serif;
}
.team-name { font-weight: 700; color: var(--ink); margin-top: .9rem; }
.team-role { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.team-card .agent-contact-buttons { justify-content: center; }
@media (max-width: 860px) { .team-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .team-grid { grid-template-columns: 1fr; } }

/* Filters */
.filters-layout { display: grid; grid-template-columns: 280px 1fr; gap: 2.5rem; }
@media (max-width: 900px) { .filters-layout { grid-template-columns: 1fr; } }
.filter-sidebar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; height: fit-content; }
.filter-sidebar label { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--muted); margin: 1rem 0 .3rem; }
.filter-sidebar label:first-of-type { margin-top: 0; }
.filter-heading { font-size: 1.15rem; color: var(--ink); }
.filter-toggle { display: none; }

@media (max-width: 900px) {
  .filter-sidebar { padding: 0; background: none; border: none; }
  .filter-heading { display: none; }
  .filter-toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1.1rem;
    font-size: .95rem; font-weight: 700; color: var(--ink); cursor: pointer; font-family: Georgia, serif;
    box-shadow: 0 2px 6px rgba(0,0,0,.04);
  }
  .filter-toggle:active { background: var(--line); }
  .filter-toggle span:last-child {
    font-size: 1rem; transition: transform .2s ease; color: #fff; background: var(--gold);
    width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  }
  .filter-toggle[aria-expanded="true"] { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .filter-toggle[aria-expanded="true"] span:last-child { transform: rotate(180deg); }
  .filter-body {
    display: none; margin-top: 0; padding: 1rem; border: 1px solid var(--line); border-top: none;
    border-radius: 0 0 12px 12px;
  }
  .filter-body.open { display: block; }
  .filter-body label:first-of-type { margin-top: 1rem; }
}
.filter-row-2 { display: flex; gap: .5rem; }
@media (max-width: 420px) { .filter-row-2 { flex-direction: column; } }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: .4rem; align-items: center; margin-top: 2.5rem; }
.pagination a, .pagination span { display: flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); font-size: .85rem; padding: 0 .6rem; }
.pagination a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination a.disabled { opacity: .4; pointer-events: none; }

/* Breadcrumb */
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a:hover { color: var(--ink); }

/* Blog */
.blog-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.blog-card .thumb { aspect-ratio: 16/10; background: var(--line); overflow: hidden; }
.blog-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.blog-card .body { padding: 1.2rem; }
.prose h2 { font-family: Georgia, serif; font-size: 1.4rem; color: var(--ink); margin: 1.6rem 0 .7rem; }
.prose p { margin-bottom: 1rem; line-height: 1.75; }
.prose ul { list-style: disc; padding-left: 1.4rem; margin-bottom: 1rem; }
.prose li { margin-bottom: .4rem; }

/* ===================== ADMIN ===================== */
.admin-body { margin: 0; background: #f4f3ee; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--foreground); }
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 260px; flex-shrink: 0; background: var(--ink); color: #fff; display: flex; flex-direction: column; }
.admin-sidebar .brand { padding: 1.5rem; font-family: Georgia, serif; font-size: 1.3rem; font-weight: 700; }
.admin-sidebar nav { flex: 1; padding: 0 .75rem; display: flex; flex-direction: column; gap: .15rem; overflow-y: auto; }
.admin-sidebar nav a { padding: .7rem .75rem; border-radius: 10px; font-size: .92rem; color: rgba(255,255,255,.75); display: flex; gap: .6rem; align-items: center; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.admin-sidebar .user-box { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.1); font-size: .82rem; }
.admin-sidebar .user-box form { margin-top: .6rem; }
.admin-main { flex: 1; padding: 2.5rem 3rem; min-width: 0; }
.admin-topbar { display: none; }
.admin-overlay { display: none; }

@media (max-width: 900px) {
  .admin-topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--ink); color: #fff; padding: 1rem 1.1rem;
    position: sticky; top: 0; z-index: 80;
  }
  .admin-topbar .brand { font-family: Georgia, serif; font-weight: 700; font-size: 1.1rem; }
  .admin-topbar button {
    background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); color: #fff;
    border-radius: 8px; padding: .5rem .7rem; font-size: 1rem; line-height: 1; cursor: pointer;
  }
  .admin-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 20px 0 40px rgba(0,0,0,.25);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-overlay {
    display: block; position: fixed; inset: 0; background: rgba(10,20,20,.5); z-index: 90;
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .admin-overlay.open { opacity: 1; pointer-events: auto; }
  .admin-main { padding: 1.25rem; }
}

.admin-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; }
@media (max-width: 980px) { .admin-cards { grid-template-columns: repeat(2, 1fr); } }
.admin-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; display: block; }
.admin-card .big { font-size: 1.8rem; font-weight: 700; color: var(--ink); }
.admin-card .lbl { font-size: .85rem; color: var(--muted); margin-top: .3rem; }

table.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
table.data-table th { background: #f4f3ee; text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 1rem; }
table.data-table td { padding: 1rem; border-top: 1px solid var(--line); font-size: .9rem; vertical-align: middle; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }

.pill { display: inline-block; background: var(--line); border-radius: 999px; padding: .3rem .7rem; font-size: .75rem; }

.chip-toggle { display: inline-flex; cursor: pointer; border: 1px solid var(--line); border-radius: 999px; padding: .4rem .9rem; font-size: .85rem; margin: .2rem; }
.chip-toggle input { display: none; }
.chip-toggle.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.uploader-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
@media (max-width: 640px) { .uploader-grid { grid-template-columns: repeat(2, 1fr); } }
.uploader-item { position: relative; aspect-ratio: 1/1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.uploader-item img { width: 100%; height: 100%; object-fit: cover; }
.uploader-item .cover-badge { position: absolute; top: 4px; left: 4px; background: var(--ink); color: #fff; font-size: .6rem; padding: .15rem .4rem; border-radius: 4px; }
.uploader-item .actions { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; background: rgba(0,0,0,.6); padding: .25rem .4rem; }
.uploader-item .actions button { background: none; border: none; color: #fff; font-size: .7rem; cursor: pointer; }
.uploader-add { display: flex; align-items: center; justify-content: center; aspect-ratio: 1/1; border: 2px dashed var(--line); border-radius: 10px; font-size: .8rem; color: var(--muted); cursor: pointer; text-align: center; }

.two-col { display: grid; grid-template-columns: 1fr 320px; gap: 1.6rem; align-items: start; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }
.sticky-col { position: sticky; top: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}

/* Bloque de enlazado interno SEO al final de la ficha de propiedad */
.seo-links-section { margin-top: 4rem; padding-top: 2.5rem; border-top: 1px solid var(--line); }
.seo-links-section h2 { font-size: 1.3rem; color: var(--ink); }
.seo-links-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; margin-top: 1.4rem; align-items: start; }
.seo-links-col { min-width: 0; }
.seo-links-municipio {
  display: block; font-size: .92rem; font-weight: 700; color: var(--ink);
  padding-bottom: .5rem; margin-bottom: .5rem; border-bottom: 2px solid var(--gold);
}
.seo-links-municipio span { font-weight: 400; color: var(--muted); }
.seo-links-municipio:hover { color: var(--ink-dark); }
.seo-links-properties li { list-style: none; }
.seo-links-properties a {
  display: block; font-size: .83rem; color: var(--foreground); padding: .35rem 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seo-links-properties a:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 900px) { .seo-links-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .seo-links-grid { grid-template-columns: 1fr; } }

/* Variante simple: solo enlaces planos con contador (tipos de propiedad
   en los listados por municipio/zona), sin la lista anidada de fichas. */
.seo-links-grid-simple { gap: .5rem 1.5rem; }
.seo-links-grid-simple a {
  display: flex; justify-content: space-between; gap: .5rem; font-size: .88rem;
  color: var(--foreground); padding: .4rem 0; border-bottom: 1px dotted var(--line);
}
.seo-links-grid-simple a span { color: var(--muted); font-size: .8rem; flex-shrink: 0; }
.seo-links-grid-simple a:hover { color: var(--ink); border-bottom-color: var(--ink); }
.seo-links-grid-simple a.is-active { color: var(--ink); font-weight: 700; border-bottom-color: var(--gold); }

/* Print stylesheet for property sheet */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}

/* Ajuste final para móviles muy pequeños (va al final a propósito,
   para que gane sobre las reglas de @media anteriores) */
@media (max-width: 480px) {
  .admin-main { padding: 1rem; }
  .admin-cards { grid-template-columns: 1fr; }
}

/* Botón de favorito (ficha de propiedad) */
.favorite-btn { display: inline-flex; align-items: center; gap: .4rem; }
.favorite-btn.is-favorited { color: #b91c1c; border-color: #b91c1c; background: #fef2f2; }

/* Modal de acceso rápido (login / registro) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(10, 20, 20, .55);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s ease; padding: 1rem;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  position: relative; background: #fff; border-radius: 20px; padding: 2rem;
  width: 100%; max-width: 380px; box-shadow: 0 30px 60px rgba(0,0,0,.3);
}
.modal-close {
  position: absolute; top: 1rem; right: 1rem; background: none; border: none;
  font-size: 1.2rem; color: var(--muted); cursor: pointer; line-height: 1;
}
.modal-tabs { display: flex; gap: .5rem; margin-top: 1.4rem; border-bottom: 1px solid var(--line); }
.modal-tab {
  flex: 1; background: none; border: none; padding: .7rem; font-size: .9rem; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.modal-tab.active { color: var(--ink); border-bottom-color: var(--gold); }
.modal-form { margin-top: 1.2rem; }
.modal-error { margin-top: 1rem; background: #fef2f2; color: #b91c1c; border-radius: 10px; padding: .7rem 1rem; font-size: .85rem; }

/* Editor de texto enriquecido (admin) */
.rich-editor-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.rich-editor-toolbar { display: flex; flex-wrap: wrap; gap: .3rem; background: #f4f3ee; padding: .5rem; border-bottom: 1px solid var(--line); }
.rich-editor-toolbar button {
  background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: .35rem .6rem;
  font-size: .8rem; cursor: pointer; color: var(--foreground);
}
.rich-editor-toolbar button:hover { background: var(--line); }
.rich-editor {
  min-height: 220px; padding: .85rem; font-size: .9rem; line-height: 1.7; outline: none;
  max-height: 480px; overflow-y: auto;
}
.rich-editor:empty:before { content: attr(data-placeholder); color: var(--muted); }
.rich-editor h2 { font-family: Georgia, serif; font-size: 1.25rem; color: var(--ink); margin: .8rem 0 .4rem; }
.rich-editor h3 { font-family: Georgia, serif; font-size: 1.05rem; color: var(--ink); margin: .7rem 0 .3rem; }
.rich-editor p { margin-bottom: .6rem; }
.rich-editor ul, .rich-editor ol { padding-left: 1.4rem; margin-bottom: .6rem; }
.rich-editor a { color: var(--ink); text-decoration: underline; }
.rich-editor-source { display: none; }

/* Widget de chat en vivo */
#chat-widget { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 180; font-family: inherit; }
#chat-bubble {
  width: 60px; height: 60px; border-radius: 50%; background: var(--ink); color: #fff; border: none;
  font-size: 1.6rem; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.25); position: relative;
  display: flex; align-items: center; justify-content: center;
}
#chat-bubble:hover { background: var(--ink-dark, var(--ink)); }
#chat-bubble-badge {
  position: absolute; top: -4px; right: -4px; background: #c0392b; color: #fff; font-size: .68rem;
  font-weight: 700; border-radius: 999px; min-width: 20px; height: 20px; display: flex; align-items: center;
  justify-content: center; padding: 0 4px; border: 2px solid #fff;
}
#chat-panel {
  display: none; position: absolute; bottom: 74px; right: 0; width: 340px; max-width: calc(100vw - 2rem);
  height: 460px; max-height: 70vh; background: #fff; border-radius: 18px; box-shadow: 0 25px 60px rgba(0,0,0,.3);
  flex-direction: column; overflow: hidden;
}
#chat-panel.open { display: flex; }
#chat-panel-header {
  background: var(--ink); color: #fff; padding: 1rem 1.1rem; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.chat-panel-title { font-family: Georgia, serif; font-size: 1.05rem; }
.chat-panel-status { font-size: .75rem; color: rgba(255,255,255,.7); margin-top: .2rem; display: flex; align-items: center; gap: .35rem; }
.chat-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; display: inline-block; }
#chat-panel-close { background: none; border: none; color: #fff; font-size: 1.1rem; cursor: pointer; }
#chat-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; background: #f8f7f3; }
.chat-msg { max-width: 82%; padding: .55rem .8rem; border-radius: 14px; font-size: .86rem; line-height: 1.4; }
.chat-msg-visitor { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg-agent { align-self: flex-start; background: #fff; border: 1px solid var(--line); color: var(--foreground); border-bottom-left-radius: 4px; }
.chat-msg-empty { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 1rem; }
.chat-identify-form, .chat-message-form { padding: .9rem; border-top: 1px solid var(--line); flex-shrink: 0; }
.chat-identify-form input { margin-bottom: .5rem; }
.chat-message-form { display: flex; gap: .5rem; }
.chat-message-form input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: .6rem 1rem; font-size: .85rem; }
.chat-message-form button { width: 40px; height: 40px; border-radius: 50%; background: var(--gold); color: #fff; border: none; cursor: pointer; flex-shrink: 0; font-size: 1rem; }

@media (max-width: 480px) {
  #chat-widget { bottom: 1rem; right: 1rem; }
  #chat-panel { width: calc(100vw - 2rem); height: 65vh; }
}
