:root {
  --green: #075e4e;
  --green-light: #84a69c;
  --accent: #d29f59;
  --bg: #f4f3f0;
  --panel: #ffffff;
  --line: #d9d6cf;
  --text: #23211e;
}

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

#topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--green);
  color: #fff;
  padding: 10px 18px;
}
#topbar h1 { font-size: 18px; margin: 0; font-weight: 600; }
#topbar .muted { opacity: 0.7; font-weight: 400; }
#proto-badge {
  margin-left: auto;
  background: var(--accent);
  color: #2a1d05;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: 999px;
}

#layout { flex: 1; display: flex; min-height: 0; }

#sidebar {
  width: 340px;
  flex: 0 0 340px;
  overflow-y: auto;
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 14px;
}

#map { flex: 1; min-width: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}
.panel h2 { font-size: 14px; margin: 0 0 8px; color: var(--green); }
.hint { font-size: 12px; color: #6c6862; margin: 0 0 10px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.btn {
  font: inherit;
  font-size: 13px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
}
.btn:hover { background: #f0efeb; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #2a1d05; font-weight: 600; width: 100%; }
.btn-primary:hover { filter: brightness(0.96); }
.btn-ghost { color: #8a857d; }
.btn.active { outline: 2px solid var(--green-light); }

.file-label { display: block; font-size: 12px; color: #6c6862; }
.file-label input { display: block; margin-top: 6px; font-size: 12px; }

.field { display: block; font-size: 13px; margin: 10px 0 0; }
.field input, .field select {
  display: block; width: 100%; margin-top: 4px;
  font: inherit; font-size: 13px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 0; }
fieldset legend { font-size: 12px; color: #6c6862; padding: 0 4px; }
fieldset label { display: inline-block; font-size: 13px; margin-right: 10px; }

.status { font-size: 12px; color: #6c6862; margin: 6px 0 0; }

.progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; }
.progress.hidden { display: none; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--green);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#results-table { font-size: 12px; overflow-x: auto; }
table.results { border-collapse: collapse; width: 100%; }
table.results th, table.results td { border: 1px solid var(--line); padding: 4px 7px; text-align: right; white-space: nowrap; }
table.results th { background: #f0efeb; text-align: center; position: sticky; top: 0; }
table.results td.id, table.results td.rank { text-align: center; font-weight: 600; }

.legend { background: rgba(255,255,255,0.92); padding: 8px 10px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.3); font-size: 11px; color: var(--text); }
.legend-item + .legend-item { margin-top: 8px; }
.legend-title { font-weight: 600; margin-bottom: 4px; }
.legend-bar { height: 10px; width: 140px; border: 1px solid #999; border-radius: 2px; }
.legend-labels { display: flex; justify-content: space-between; margin-top: 2px; color: #555; }
.legend-cats { display: flex; flex-direction: column; gap: 3px; }
.legend-cat { display: flex; align-items: center; }
.legend-swatch { display: inline-block; width: 12px; height: 12px; border: 1px solid #999; border-radius: 2px; margin-right: 6px; }

.rank-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.site-label { font-weight: 700; color: #222; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
