:root {
  --bg: #f1ede4;
  --panel: #fbf7ef;
  --ink: #272018;
  --muted: #6f6557;
  --accent: #8a3b12;
  --line: #d8cfbf;
  --road: #2f4f4f;
  --contour: #8f8f8f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 0%, #f8f1e1 0%, var(--bg) 48%);
}

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

.panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 1rem;
  overflow-y: auto;
}

.panel h1 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.15;
}

.subtitle {
  margin: 0.45rem 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.control-row {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: 1fr 1fr;
}

.control-group {
  margin-bottom: 0.8rem;
  position: relative;
}

.control-group.inline {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

label {
  display: block;
  margin-bottom: 0.28rem;
  font-size: 0.82rem;
  color: #4d4336;
}

input[type="text"],
select,
button {
  font: inherit;
}

input[type="text"],
select {
  width: 100%;
  border: 1px solid #ccbfa8;
  border-radius: 8px;
  background: #fffdfa;
  padding: 0.45rem 0.55rem;
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

.hidden {
  display: none !important;
}

.search-preview {
  margin-top: 0.35rem;
  border: 1px solid #d8cfbf;
  border-radius: 8px;
  background: #fffdf9;
  max-height: 220px;
  overflow: auto;
}

.search-preview-item {
  width: 100%;
  display: block;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #ece5d9;
  background: transparent;
  cursor: pointer;
  padding: 0.45rem 0.55rem;
}

.search-preview-item:last-child {
  border-bottom: 0;
}

.search-preview-item:hover {
  background: #f5efe2;
}

.search-preview-title {
  font-size: 0.86rem;
  color: #2f281f;
}

.search-preview-meta {
  margin-top: 0.12rem;
  font-size: 0.74rem;
  color: #7d6f5a;
}

.actions {
  grid-template-columns: 1fr 1fr;
  margin-top: 0.25rem;
}

button {
  border: 1px solid #b89f84;
  background: linear-gradient(180deg, #f7f2e7, #eadfce);
  color: #3a2f1f;
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
}

button:hover {
  border-color: #9f876c;
}

.stats {
  margin-top: 0.9rem;
  border: 1px solid #d8cfbf;
  border-radius: 8px;
  background: #fffdf9;
  padding: 0.65rem;
  line-height: 1.4;
  font-size: 0.9rem;
}

.small-print {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  line-height: 1.35;
}

.map-wrap {
  position: relative;
}

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

.leaflet-popup-content {
  margin: 0.8rem;
  min-width: 210px;
  line-height: 1.35;
}

.popup-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: #4e2d1c;
}

.popup-grid {
  display: grid;
  gap: 0.2rem;
  font-size: 0.86rem;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .control-row {
    grid-template-columns: 1fr;
  }
}
