:root {
  --brand: #1b6e3c;
  --brand-dark: #12502b;
  --ink: #1c2321;
  --muted: #5b6663;
  --bg: #f6f5f1;
  --card: #ffffff;
  --border: #e2e0d8;
  --available: #1b6e3c;
  --sold: #b6402f;
  --pending: #c98a1f;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

a { color: var(--brand); }

/* ---------- Gate page ---------- */

.gate-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(27,110,60,0.08), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(27,110,60,0.10), transparent 45%),
    var(--bg);
}

.gate-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  max-width: 460px;
  width: 100%;
  padding: 40px 36px;
  border: 1px solid var(--border);
}

.gate-card h1 {
  font-size: 24px;
  margin: 0 0 8px;
  line-height: 1.3;
}

.gate-card p.lede {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.5;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.field input,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid #cfd3ce;
  font-size: 15px;
  font-family: inherit;
  background: #fcfcfb;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}

.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.gate-footnote {
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
  text-align: center;
}

.error-msg {
  background: #fdecea;
  color: #8a2c22;
  border: 1px solid #f3c6c0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

/* ---------- Map app ---------- */

.app {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  font-size: 16px;
  margin: 0 0 2px;
}

.sidebar-header .sub {
  font-size: 12px;
  color: var(--muted);
}

.brand { margin-bottom: 2px; }

.logo-fallback {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.03em;
  color: var(--brand-dark);
  line-height: 1.15;
}

.logo-fallback span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--brand);
}

.brand img { max-height: 64px; max-width: 100%; }

.tagline {
  font-style: italic;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  margin: 3px 0 6px;
}

.contact-footer {
  border-top: 1px solid var(--border);
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: #faf9f6;
  flex-shrink: 0;
}

.contact-line, .tiktok-link {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}

.tiktok-link { color: var(--brand); }

.filters {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filters select,
.filters input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid #cfd3ce;
  font-size: 13px;
  font-family: inherit;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.sold-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fdf2f0;
  border: 1.5px solid #f0c9c2;
  border-radius: 9px;
  cursor: pointer;
  user-select: none;
}

.sold-toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.sold-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.sold-toggle-knob {
  position: absolute;
  inset: 0;
  background: #c7c2bd;
  border-radius: 999px;
  transition: background 0.15s;
}

.sold-toggle-knob::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.sold-toggle-switch input:checked + .sold-toggle-knob {
  background: var(--sold);
}

.sold-toggle-switch input:checked + .sold-toggle-knob::before {
  transform: translateX(16px);
}

.sold-toggle-text {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.sold-toggle-es {
  font-weight: 500;
  color: var(--muted);
}

.lot-list {
  overflow-y: auto;
  flex: 1;
}

.lot-row {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.lot-row:hover { background: #f2f6f3; }
.lot-row.active { background: #e6f3ea; }

.lot-row .lot-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 1px;
}

.lot-row .price {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

.lot-row .meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 7px;
  border-radius: 5px;
  white-space: nowrap;
  color: white;
}

.badge.available { background: var(--available); }
.badge.sold { background: var(--sold); }
.badge.pending { background: var(--sold); }

#map { width: 100%; height: 100%; }

.leaflet-popup-content {
  font-size: 13px;
  line-height: 1.5;
  min-width: 200px;
}

.leaflet-popup-content .popup-lot-number {
  font-size: 11px;
  font-weight: 700;
  color: #888;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.leaflet-popup-content .popup-price {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.leaflet-popup-content .popup-cta {
  display: inline-block;
  margin-top: 8px;
  background: var(--brand);
  color: white;
  padding: 7px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 12.5px;
}

.top-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1000;
  display: flex;
  gap: 8px;
}

.top-actions button {
  background: white;
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.empty-state {
  padding: 30px 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 40vh 60vh; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ---------- Admin ---------- */

.admin-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.admin-wrap h1 { font-size: 22px; margin-bottom: 4px; }
.admin-wrap .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

table.leads {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

table.leads th, table.leads td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

table.leads th {
  background: #f2f1ec;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.stat-row {
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  min-width: 120px;
}

.stat-card .num { font-size: 22px; font-weight: 700; }
.stat-card .label { font-size: 12px; color: var(--muted); }

.export-btn {
  display: inline-block;
  background: var(--brand);
  color: white;
  padding: 9px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}
