:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1c1c;
  --muted: #6b6b6b;
  --border: #e3e3df;
  --primary: #14532d;
  --primary-dark: #0f3d21;
  --accent: #c9a227;
  --danger: #b3261e;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.07);
  --max: 1100px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand span { color: var(--primary); }
.nav { display: flex; gap: 20px; align-items: center; font-size: 0.95rem; }
.nav a { color: var(--muted); }
.nav a:hover, .nav a.active { color: var(--primary); }

/* Hero */
.hero { background: linear-gradient(135deg, var(--primary), #1f7a45); color: #fff; padding: 56px 0; }
.hero h1 { margin: 0 0 10px; font-size: 2rem; letter-spacing: -0.02em; }
.hero p { margin: 0; opacity: 0.9; max-width: 640px; }

/* Filters */
.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: -28px auto 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto;
  gap: 12px;
  box-shadow: var(--shadow);
}
.filters input, .filters select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: #f0f0ec; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #8f1d17; }
.btn.small { padding: 6px 12px; font-size: 0.82rem; }

/* Property grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; padding-bottom: 48px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.card .thumb { aspect-ratio: 4 / 3; background: #ddd center/cover no-repeat; }
.card .body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 1.05rem; }
.card .price { font-weight: 700; color: var(--primary); font-size: 1.15rem; }
.card .meta { color: var(--muted); font-size: 0.85rem; }
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #eef4ef;
  color: var(--primary);
  text-transform: capitalize;
  width: fit-content;
}
.badge.featured { background: var(--accent); color: #3a2f00; }
.badge.status-vendido, .badge.status-alquilado { background: #f2e6e5; color: var(--danger); }

/* Detail */
.detail { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; padding: 32px 0 64px; }
.detail .gallery { aspect-ratio: 16 / 10; background: #ddd center/cover no-repeat; border-radius: var(--radius); }
.detail h1 { margin: 0 0 8px; font-size: 1.7rem; }
.detail .price { font-size: 1.6rem; color: var(--primary); font-weight: 700; margin: 12px 0; }
.specs { display: flex; flex-wrap: wrap; gap: 16px; margin: 16px 0; color: var(--muted); }
.specs strong { color: var(--text); }

/* Forms */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: inherit;
  background: #fff;
}
.field textarea { min-height: 90px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 0.9rem; margin-bottom: 14px; }
.alert.error { background: #fbe9e7; color: var(--danger); }
.alert.success { background: #e7f4ec; color: var(--primary); }

.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }

/* Admin */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 24px 0 64px; }
.sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; height: fit-content; }
.sidebar a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--muted); font-size: 0.92rem; }
.sidebar a:hover, .sidebar a.active { background: #eef4ef; color: var(--primary); }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.table th { background: #fafaf8; font-weight: 600; }
.table tr:last-child td { border-bottom: none; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

.image-preview { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.image-preview img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

footer.site-footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--muted); font-size: 0.85rem; background: var(--surface); }

@media (max-width: 820px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .detail { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
}
