:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --border: rgba(0,0,0,0.08);
  --accent: #1a1a1a;
  --accent-soft: #525252;
  --lead: #166534;
  --lead-bg: #ecfdf5;
  --shadow: 0 2px 16px rgba(0,0,0,0.06);
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(246,246,244,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
}
.brand strong { display: block; font-size: 1rem; }
.brand span { font-size: 0.75rem; color: var(--muted); }

.topbar-actions { display: flex; gap: 8px; }

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "hero hero"
    "search map"
    "email email"
    "stats stats"
    "results results";
}

.hero-panel { grid-area: hero; }
.search-panel { grid-area: search; }
.email-panel { grid-area: email; }
.map-panel { grid-area: map; }
.stats-panel { grid-area: stats; }
.results-panel { grid-area: results; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.hero-panel h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.lead { color: var(--muted); max-width: 640px; margin-bottom: 16px; }

.pill-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-list li {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
}

h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; }

.form-grid { display: grid; gap: 14px; margin-bottom: 14px; }

.field span {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: var(--bg);
}

.field textarea { resize: vertical; min-height: 120px; }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.panel-head h2 { margin-bottom: 0; }
.panel-hint { font-size: 0.72rem; color: var(--muted); }

.sender-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.search-progress {
  margin-top: 14px;
  padding: 12px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.search-progress p {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 8px 0;
}

.progress-track {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 35%;
  background: var(--accent);
  border-radius: 999px;
  animation: progress-slide 1.2s ease-in-out infinite;
}

@keyframes progress-slide {
  0% { transform: translateX(-100%); width: 40%; }
  50% { width: 60%; }
  100% { transform: translateX(250%); width: 40%; }
}

.btn.sm { padding: 6px 12px; font-size: 0.78rem; }

.field-hint {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--lead);
  font-weight: 500;
}

.field-hint.error { color: #b91c1c; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 14px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s;
}

.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.btn.full { width: 100%; padding: 13px; }

.map-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.map-hint { font-size: 0.72rem; color: var(--muted); }

#map {
  height: 360px;
  border-radius: 12px;
  border: 1px solid var(--border);
  z-index: 1;
  margin-bottom: 10px;
}

.locate-inline { margin-top: 8px; width: 100%; }
.locate-btn { width: 100%; margin-top: 0; }

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--muted);
}

.dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.dot.lead { background: #22c55e; }
.dot.ok { background: #94a3b8; }
.dot.center { background: #1a1a1a; }

.stats-panel {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 16px;
}

.stat {
  text-align: center;
  padding: 12px;
  background: var(--bg);
  border-radius: 10px;
}

.stat strong {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
}

.stat span { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.results-head p { font-size: 0.85rem; color: var(--muted); }

.results-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.results-list { display: grid; gap: 10px; }

.card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  transition: border-color 0.15s;
}

.card:hover { border-color: rgba(0,0,0,0.15); }
.card.selected { border-color: var(--accent); background: #fff; }

.card-check { margin-top: 4px; }

.card-body h3 { font-size: 1rem; margin-bottom: 4px; }
.card-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.card-meta {
  display: grid;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

.card-meta .web-link {
  color: var(--accent-soft);
  font-weight: 600;
  word-break: break-all;
}

.badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.card.contacted { opacity: 0.72; }
.card.contacted .card-body h3 { text-decoration: line-through; text-decoration-color: var(--muted); }

.stat.highlight {
  background: var(--lead-bg);
  border: 1px solid #bbf7d0;
}

.stat.highlight strong { color: var(--lead); }

.badge.hunter { background: #ede9fe; color: #5b21b6; }
.badge.guessed { background: #fef3c7; color: #92400e; }
.badge.scraped { background: #dbeafe; color: #1d4ed8; }
.badge.osm { background: #ede9fe; color: #5b21b6; }

.card.has-email { border-color: #86efac; }
.badge.ok { background: #f1f5f9; color: #475569; }
.badge.sent { background: #dbeafe; color: #1d4ed8; }
.badge.email { background: #fef3c7; color: #92400e; }

.btn-email {
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.btn-email:hover { transform: translateY(-1px); }

.card-links { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.card-links a, .card-links button { font-size: 0.78rem; font-weight: 600; color: var(--accent-soft); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 300;
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

.footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas: "hero" "search" "email" "map" "stats" "results";
  }
  #map { height: 280px; }
  .stats-panel { grid-template-columns: repeat(2, 1fr); }
  .card { grid-template-columns: auto 1fr; }
  .card-links { grid-column: 2; flex-direction: row; flex-wrap: wrap; }
}

