:root {
  --bg: #f3efe7;
  --panel: #fffdfa;
  --panel-soft: #f7f1e8;
  --text: #27201a;
  --muted: #7a6c5e;
  --accent: #c57f39;
  --accent-strong: #8b5a2b;
  --border: #e4d7c7;
  --danger: #dc2626;
  --success: #15803d;
  --info: #2563eb;
  --shadow: 0 18px 40px rgba(75, 51, 25, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(180deg, #f8f4ed 0%, #efe6d8 100%);
  color: var(--text);
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  padding: 18px 24px;
  background: rgba(255, 250, 243, 0.96);
  border-bottom: 1px solid var(--border);
}

.brand-copy h1 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.1;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

#app {
  display: flex;
  height: calc(100vh - 82px);
  overflow: hidden;
}

.sidebar {
  width: 390px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  transition: transform 0.3s ease-in-out;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.info {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.6;
}

.controls {
  display: grid;
  gap: 14px;
}

.category-selector {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

.field input:focus {
  outline: 2px solid rgba(197, 127, 57, 0.2);
  border-color: var(--accent);
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.selector-head {
  gap: 4px;
}

.dropdown {
  position: relative;
}

.dropdown-field {
  gap: 10px;
}

.dropdown-input-wrap {
  position: relative;
}

.dropdown-input-wrap input {
  padding-right: 52px;
}

.dropdown-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--panel-soft);
  cursor: pointer;
}

.dropdown-caret {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--accent-strong);
  border-bottom: 2px solid var(--accent-strong);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.18s ease;
}

.dropdown.is-open .dropdown-caret {
  transform: rotate(-135deg) translate(1px, -1px);
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 20;
  border: 1px solid rgba(228, 215, 199, 0.9);
  border-radius: 18px;
  background: rgba(255, 253, 250, 0.98);
  box-shadow: 0 24px 60px rgba(75, 51, 25, 0.18);
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  animation: dropdown-in 0.18s ease forwards;
  backdrop-filter: blur(10px);
}

.dropdown-options {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
}

.dropdown-group + .dropdown-group {
  margin-top: 6px;
}

.dropdown-group-title {
  margin: 10px 8px 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.dropdown-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.dropdown-option:hover {
  background: #fff5e9;
  border-color: rgba(197, 127, 57, 0.2);
}

.dropdown-option.is-selected {
  background: #fff0dc;
  border-color: rgba(197, 127, 57, 0.28);
}

.dropdown-option-body {
  display: grid;
  gap: 4px;
}

.dropdown-option-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.dropdown-option-meta {
  font-size: 12px;
  color: var(--muted);
}

.dropdown-option-marker {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.7);
}

.dropdown-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.search-button {
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #d9974d, #b56f31);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 13px 16px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(181, 111, 49, 0.24);
}

.search-button:disabled {
  opacity: 0.72;
  cursor: wait;
}

.status-message {
  min-height: 22px;
  margin-top: 16px;
  font-size: 13px;
}

.status-message[data-tone='error'] {
  color: var(--danger);
}

.status-message[data-tone='success'] {
  color: var(--success);
}

.status-message[data-tone='loading'],
.status-message[data-tone='info'] {
  color: var(--info);
}

.summary {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #fffaf2 0%, #fff 100%);
}

.summary-title {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.selection-summary,
.result-count {
  margin: 0;
  font-size: 14px;
}

.result-count {
  margin-top: 8px;
}

.results-panel {
  margin-top: 18px;
}

.results-header h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

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

.item,
.empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.item h3 {
  margin: 0;
  font-size: 14px;
}

.item .meta {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.item a {
  color: var(--accent-strong);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.empty-state {
  justify-content: center;
  color: var(--muted);
}

#map {
  position: relative;
  flex: 1;
  background: #ded8ce;
}

.menu-toggle {
  display: none;
  position: absolute;
  top: 96px;
  left: 20px;
  background: rgba(39, 32, 26, 0.75);
  color: white;
  border: none;
  padding: 10px 14px;
  font-size: 20px;
  border-radius: 10px;
  z-index: 1300;
  cursor: pointer;
}

.leaflet-control-zoom {
  display: none !important;
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .topbar {
    min-height: 74px;
    padding: 16px 18px;
  }

  .brand-copy h1 {
    font-size: 20px;
  }

  #app {
    height: calc(100vh - 74px);
  }

  .sidebar {
    position: absolute;
    top: 74px;
    left: 0;
    height: calc(100vh - 74px);
    width: min(90vw, 390px);
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .menu-toggle {
    display: block;
  }
}
