:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --border: #e2e8e4;
  --text: #16241f;
  --muted: #6b7a74;
  --accent: #1f8a5b;
  --accent-strong: #176b46;
  --accent-soft: #e7f4ed;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(22, 36, 31, 0.08);
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent); color: #fff; font-weight: 700;
}
.header-meta { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--muted); }
.region { font-weight: 600; color: var(--text); }

/* Landing */
.landing { min-height: calc(100vh - 52px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.landing-inner { max-width: 560px; text-align: center; }
.landing h1 { font-size: 32px; line-height: 1.2; margin: 0 0 12px; }
.lede { color: var(--muted); font-size: 17px; line-height: 1.5; margin: 0 0 24px; }
.landing-cta { display: flex; gap: 10px; justify-content: center; }
.notice { margin-top: 20px; font-size: 13px; color: #a16207; background: #fef3c7; padding: 10px 12px; border-radius: var(--radius); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; border-radius: var(--radius);
  font-weight: 600; font-size: 15px; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); text-decoration: none; }
.btn-block { width: 100%; }
.btn-small { padding: 5px 10px; font-size: 13px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.btn-small:hover { border-color: var(--accent); text-decoration: none; }

/* Layout */
.app-layout { display: flex; height: calc(100vh - 52px); }
.map { flex: 1; height: 100%; }
.sidebar {
  width: 360px; overflow-y: auto; background: var(--bg);
  border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; padding: 12px;
}

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 10px; font-size: 15px; }

textarea {
  width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; resize: vertical; margin-bottom: 10px;
}
textarea:focus { outline: none; border-color: var(--accent); }

.layer-toggle { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; cursor: pointer; }

.htmx-indicator { display: none; font-size: 13px; color: var(--muted); margin-top: 8px; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; }

/* Results */
.empty-state { color: var(--muted); font-size: 14px; padding: 8px 0; }
.error { color: #b91c1c; background: #fee2e2; padding: 10px 12px; border-radius: var(--radius); font-size: 14px; margin-bottom: 10px; }

.criteria-card { background: var(--accent-soft); border: 1px solid #cde8d9; border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; }
.criteria-card h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--accent-strong); }
.criteria-list { margin: 0; padding-left: 18px; font-size: 14px; }
.criteria-list li { margin: 2px 0; }

.results-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; }
.results-head h3 { margin: 0; font-size: 14px; }

.results-list { list-style: none; margin: 0; padding: 0; }
.result-row { border-bottom: 1px solid var(--border); }
.result-row a { display: block; padding: 8px 4px; color: var(--text); }
.result-row a:hover { background: var(--accent-soft); text-decoration: none; }
.result-row strong { display: block; font-size: 14px; }
.result-meta { font-size: 12px; color: var(--muted); }

/* Site detail */
.site-detail { margin-top: 12px; border-top: 2px solid var(--border); padding-top: 12px; }
.site-detail h3 { margin: 0 0 10px; font-size: 16px; }
.detail-layer { margin-bottom: 14px; }
.detail-layer h4 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.detail-layer ul { margin: 0; padding-left: 16px; font-size: 13px; }
.detail-layer li { margin: 3px 0; }
.detail-layer dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 13px; }
.detail-layer dt { color: var(--muted); }
.detail-layer dd { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }

/* Provenance badges */
.badge { font-size: 11px; padding: 2px 7px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.badge-matched, .badge-derived { background: #e7f4ed; color: #176b46; }
.badge-estimated { background: #fef3c7; color: #a16207; }
.badge-unavailable, .badge-requires-verification { background: #fee2e2; color: #b91c1c; }

/* Leaflet result markers */
.result-dot { background: var(--accent); border: 2px solid #fff; border-radius: 50%; }

/* Hover highlight for linked marker/row */
.result-row--hover { background: var(--accent-soft); }
