:root {
  --finca-green: #075d2b;
  --finca-green-2: #0e7a3b;
  --masa: #f4b000;
  --tomato: #b73a20;
  --ink: #1f2933;
  --muted: #65727e;
  --line: #d9e0d8;
  --paper: #fffaf0;
  --surface: #ffffff;
  --surface-alt: #f5f7f1;
  --shadow: 0 18px 45px rgba(31, 41, 51, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: relative;
  z-index: 3;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 240px;
}

.brand-logo {
  width: 70px;
  height: 66px;
  display: block;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand p,
.brand h1 {
  margin: 0;
}

.brand p {
  color: var(--muted);
  font-size: 0.92rem;
}

.brand h1 {
  color: var(--finca-green);
  font-size: clamp(1.55rem, 2.3vw, 2.2rem);
  line-height: 1.05;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.main-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 820;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  color: var(--surface);
  background: var(--finca-green);
  outline: none;
}

.main-nav a:first-child {
  color: var(--finca-green);
  border: 1px solid var(--line);
  background: var(--surface-alt);
}

.main-nav a:first-child:hover,
.main-nav a:first-child:focus-visible {
  color: var(--surface);
  border-color: var(--finca-green);
  background: var(--finca-green);
}

.locator {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
}

.sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.controls {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.search-field {
  display: grid;
  gap: 7px;
}

.search-field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.search-field input {
  width: 100%;
  height: 44px;
  border: 1px solid #c9d3c8;
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--surface-alt);
  outline: none;
}

.search-field input:focus {
  border-color: var(--finca-green-2);
  box-shadow: 0 0 0 3px rgba(14, 122, 59, 0.16);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2e8;
}

.segmented button,
.secondary-action {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  font-weight: 780;
}

.segmented button.is-active {
  color: var(--surface);
  background: var(--finca-green);
  box-shadow: 0 5px 12px rgba(7, 93, 43, 0.2);
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
}

.secondary-action {
  border: 1px solid var(--line);
  padding: 0 13px;
  background: var(--surface);
}

#nearMeButton {
  border-color: #d69b00;
  color: #3b2b00;
  background: var(--masa);
  box-shadow: 0 5px 12px rgba(244, 176, 0, 0.22);
}

.secondary-action:hover {
  border-color: var(--finca-green-2);
  color: var(--finca-green);
}

#nearMeButton:hover {
  border-color: #bd8700;
  color: #2a1f00;
  background: #ffc531;
}

.secondary-action:disabled {
  cursor: wait;
  color: var(--muted);
  background: var(--surface-alt);
  box-shadow: none;
}

.status {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.location-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  background: #f8f5ea;
}

.location-card {
  display: grid;
  gap: 9px;
  width: 100%;
  margin: 0 0 10px;
  padding: 14px;
  border: 1px solid #dfe5d9;
  border-left: 5px solid var(--finca-green);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(31, 41, 51, 0.05);
}

.location-card.is-selected {
  border-color: var(--finca-green);
  box-shadow: 0 0 0 3px rgba(14, 122, 59, 0.18);
}

.location-card[data-category="Store"] {
  border-left-color: var(--masa);
}

.location-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.location-card h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.22;
}

.badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--surface);
  background: var(--finca-green);
  font-size: 0.72rem;
  font-weight: 850;
}

.badge.store {
  color: #3b2b00;
  background: var(--masa);
}

.address,
.distance {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

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

.card-actions a,
.card-actions button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0 12px;
  text-decoration: none;
  font-weight: 820;
}

.card-actions a {
  color: var(--surface);
  background: var(--tomato);
}

.card-actions button {
  border: 1px solid var(--line);
  color: var(--finca-green);
  background: var(--surface);
}

.empty-state {
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
}

.map-panel {
  position: relative;
  min-height: 0;
}

.map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.map-fallback {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
}

.popup-name {
  margin: 0 0 5px;
  color: var(--finca-green);
  font-weight: 850;
}

.popup-address {
  margin: 0 0 10px;
  color: var(--muted);
}

.popup-link {
  color: var(--tomato);
  font-weight: 850;
}

.you-are-here-popup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 850;
}

.happy-face {
  position: relative;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 2px solid #875a00;
  border-radius: 50%;
  background:
    radial-gradient(circle at 9px 9px, var(--ink) 0 2.5px, transparent 3px),
    radial-gradient(circle at 18px 9px, var(--ink) 0 2.5px, transparent 3px),
    var(--masa);
  box-shadow: inset 0 -3px 0 rgba(135, 90, 0, 0.18);
}

.happy-face::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 13px;
  width: 14px;
  height: 9px;
  border-bottom: 3px solid var(--ink);
  border-radius: 0 0 999px 999px;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
  }

  .main-nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .locator {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(310px, 42dvh) minmax(420px, 1fr);
  }

  .map-panel {
    grid-row: 1;
  }

  .sidebar {
    grid-row: 2;
    border-top: 1px solid var(--line);
    border-right: 0;
  }
}

@media (max-width: 560px) {
  .brand {
    gap: 12px;
    min-width: 0;
  }

  .brand-logo {
    width: 58px;
    height: 54px;
  }

  .brand h1 {
    font-size: 1.55rem;
  }

  .main-nav {
    flex-wrap: wrap;
    gap: 5px;
    overflow-x: visible;
  }

  .main-nav a {
    min-height: 36px;
    padding: 0 9px;
    font-size: 0.9rem;
  }

  .controls {
    padding: 14px;
  }

  .segmented {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-top: 12px;
  }

  .segmented button {
    min-height: 40px;
    padding: 0 4px;
    font-size: 0.92rem;
  }

  .actions {
    grid-template-columns: minmax(0, 1.45fr) minmax(86px, 0.55fr);
    gap: 6px;
  }

  .secondary-action {
    min-height: 42px;
    padding: 0 8px;
    font-size: 0.92rem;
  }
}
