:root {
  --ink: #17201b;
  --muted: #617066;
  --soft: #edf1ed;
  --paper: #ffffff;
  --line: #dce4dd;
  --leaf: #2f6f4e;
  --leaf-dark: #1f4d39;
  --berry: #b83b5e;
  --sun: #f1b84b;
  --blueberry: #5065b1;
  --shadow: 0 18px 45px rgba(29, 44, 35, 0.16);
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  font-family: "Lato", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #dfe9df;
  overflow: hidden;
}

button,
select,
input {
  font: inherit;
}

/* Leaflet layout fallback. The page still loads Leaflet from CDN, but these
   rules keep the map usable if the remote Leaflet CSS is blocked or delayed. */
.leaflet-container {
  position: relative;
  overflow: hidden;
  font-family: "Lato", system-ui, sans-serif;
  background: #f3f5f0;
  outline: 0;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  user-select: none;
  -webkit-user-drag: none;
}

.leaflet-tile {
  width: 256px;
  height: 256px;
  border: 0;
}

.leaflet-map-pane { z-index: 400; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }

.leaflet-control-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 800;
}

.leaflet-top,
.leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-top { top: 0; }
.leaflet-bottom { bottom: 0; }
.leaflet-left { left: 0; }
.leaflet-right { right: 0; }

.leaflet-control {
  position: relative;
  z-index: 800;
  pointer-events: auto;
  float: left;
  clear: both;
}

.leaflet-right .leaflet-control { float: right; }
.leaflet-top .leaflet-control { margin-top: 12px; }
.leaflet-bottom .leaflet-control { margin-bottom: 12px; }
.leaflet-left .leaflet-control { margin-left: 12px; }
.leaflet-right .leaflet-control { margin-right: 12px; }

.leaflet-control-zoom {
  border: 1px solid rgba(23, 32, 27, 0.16);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 20px rgba(23, 32, 27, 0.12);
}

.leaflet-control-zoom a {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.leaflet-control-zoom a:last-child { border-bottom: 0; }

.leaflet-control-attribution {
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 11px;
}

.leaflet-control-attribution a {
  color: var(--leaf-dark);
}

.leaflet-popup {
  position: absolute;
  margin-bottom: 20px;
  text-align: left;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #fff;
  box-shadow: 0 8px 22px rgba(23, 32, 27, 0.18);
}

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

.leaflet-popup-content {
  margin: 12px 14px;
  min-width: 160px;
}

.leaflet-popup-tip-container {
  position: absolute;
  left: 50%;
  width: 40px;
  height: 20px;
  margin-left: -20px;
  overflow: hidden;
  pointer-events: none;
}

.leaflet-popup-tip {
  width: 14px;
  height: 14px;
  margin: -7px auto 0;
  transform: rotate(45deg);
}

.leaflet-popup-close-button {
  position: absolute;
  top: 4px;
  right: 7px;
  border: 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 18px;
}

.berry-app {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.berry-top {
  position: relative;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(26, 40, 31, 0.08);
  padding: 18px clamp(16px, 2.4vw, 30px);
}

.utility-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
}

.home-link,
.feedback-link a {
  color: var(--leaf-dark);
  text-decoration: none;
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}

.home-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feedback-link a {
  border-bottom: 1px solid rgba(31, 77, 57, 0.28);
}

.berry-intro {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.berry-intro::-webkit-scrollbar { display: none; }

.controls-cluster {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  width: max-content;
  min-width: max-content;
}

.filters-stack {
  display: grid;
  gap: 8px;
  min-width: max-content;
}

.top-stats {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.top-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.top-stats strong {
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.quick-filter-bar,
.controls-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  min-width: max-content;
}

.controls-row {
  gap: 8px;
}

.filter-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
}

.berry-chip {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 400;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.berry-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.berry-chip:hover {
  border-color: #aebcaf;
}

.berry-chip.is-active {
  color: var(--chip-color, var(--berry));
  background: var(--chip-active-bg, #f8e1e7);
  border-color: var(--chip-active-border, #e7b7c5);
}

.quick-produce-chip {
  color: var(--leaf-dark);
}

.chip-icon {
  display: block;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  overflow: visible;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5));
}

.select-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 6px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.select-filter select {
  height: 24px;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  font-weight: 400;
  outline: none;
  cursor: pointer;
}

.status-select-filter {
  position: relative;
  width: 126px;
  max-width: 126px;
  padding-right: 24px;
}

.status-select-filter > span:first-child {
  flex: 0 0 auto;
}

.status-select-filter .select-display {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-select-filter select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.status-select-filter::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  pointer-events: none;
  transform: translateY(-65%) rotate(45deg);
}

.checkbox-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 6px 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.checkbox-filter input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--leaf-dark);
  cursor: pointer;
}

.search-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.farm-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 420px;
  max-width: 38vw;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 6px 11px;
  color: var(--muted);
}

.farm-search svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.farm-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  line-height: 24px;
  padding: 0 4px 0 0;
}

.farm-search input::placeholder {
  color: var(--muted);
}

.farm-search input::-webkit-search-cancel-button {
  width: 15px;
  height: 15px;
  margin: 0 2px 0 8px;
  cursor: pointer;
}

.farm-search input::-webkit-calendar-picker-indicator {
  display: none !important;
}

.farm-search input::-webkit-list-button {
  display: none !important;
}

.search-submit {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf7;
  color: var(--leaf-dark);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.search-submit:hover {
  transform: translateY(-1px);
  border-color: #c6d5c8;
  background: #edf5ee;
}

.search-submit svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-status {
  position: absolute;
  left: 0;
  top: calc(100% + 3px);
  max-width: 140px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-shell {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

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

.farm-panel {
  position: absolute;
  z-index: 10;
  top: 24px;
  right: clamp(48px, 6vw, 88px);
  width: 480px;
  max-width: calc(100vw - 112px);
  max-height: calc(100% - 48px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel-empty,
.farm-card {
  padding: 22px;
}

.panel-empty h2,
.farm-card h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.08;
  letter-spacing: 0;
}

.farm-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.farm-title > span:last-child {
  min-width: 0;
}

.farm-status-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: 0 0 auto;
  cursor: help;
}

.farm-status-icon.is-open {
  color: #1f4d39;
  background: #e7f3eb;
}

.farm-status-icon.is-paused {
  color: #59615c;
  background: #edf0ed;
}

.farm-status-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panel-empty p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.farm-meta {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.farm-meta p {
  margin: 0;
}

.meta-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.checked-text {
  color: var(--muted);
  margin: 0 0 0 4px;
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}

.meta-icon-link {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7faf7;
  color: var(--leaf-dark);
  text-decoration: none;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.meta-icon-link:hover {
  transform: translateY(-1px);
  border-color: #c6d5c8;
  background: #edf5ee;
}

.meta-icon-link svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.google-rating-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px 4px 7px;
  background: #fffaf0;
  color: #6c4a0f;
  text-decoration: none;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
}

.google-rating-pill .rating-star {
  width: 13px;
  height: 13px;
}

.amenity-list,
.produce-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
}

.produce-section {
  display: grid;
  gap: 10px;
  margin: 16px 0 18px;
}

.produce-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: start;
  column-gap: 12px;
  margin: 0;
}

.produce-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 30px;
}

.produce-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 10px;
  background: #f3f5f3;
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
}

.tag-produce {
  color: var(--muted);
  background: #f6f7f4;
}

.tag.is-available {
  color: var(--leaf-dark);
  background: #e8f4eb;
  border: 1px solid #cfe2d3;
}

.tag.is-unavailable {
  color: #8a4f4f;
  background: #f7eeee;
  border: 1px solid #ead6d6;
}

.produce-icon {
  display: block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
}

.twemoji-icon {
  object-fit: contain;
}

.tag-berry {
  color: var(--muted);
  background: #f6f7f4;
}

.tag-berry.is-available {
  color: var(--leaf-dark);
  background: #e8f4eb;
}

.tag-berry.is-unavailable {
  color: #8a4f4f;
  background: #f7eeee;
}

.tag-icon {
  display: block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  overflow: visible;
}

.produce-toggle {
  display: flex;
  flex-wrap: wrap;
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f7f4;
}

.produce-toggle button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  padding: 7px 9px;
  white-space: nowrap;
}

.produce-toggle button.is-active {
  background: var(--paper);
  color: var(--leaf-dark);
  box-shadow: 0 1px 3px rgba(23, 32, 27, 0.1);
}

.detail-lines {
  display: grid;
  gap: 10px;
  margin: 16px 0 18px;
}

.detail-lines p {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  align-items: center;
  column-gap: 16px;
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.detail-lines p:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.detail-lines p > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.detail-lines .detail-value {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.25;
}

.detail-lines .booking-value {
  align-items: center;
}

.booking-value > span {
  min-width: 0;
  flex: 1 1 auto;
  width: max-content;
  max-width: 100%;
}

.booking-warning {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: #9b6a16;
  cursor: help;
  flex: 0 0 18px;
}

.warning-icon {
  width: 18px;
  height: 18px;
  fill: #fff3bf;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 30;
  width: 230px;
  transform: translateX(-50%) translateY(4px);
  border: 1px solid #ead39a;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff9e8;
  color: #5f4213;
  box-shadow: 0 10px 24px rgba(80, 55, 12, 0.16);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.tooltip,
.tooltip * {
  font-weight: 400 !important;
}

.farm-status-icon .tooltip {
  left: 0;
  top: calc(100% + 10px);
  bottom: auto;
  transform: translateY(-4px);
}

.booking-warning .tooltip {
  left: -78px;
  width: 248px;
  max-width: calc(100vw - 48px);
  transform: translateY(4px);
}

.tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -5px) rotate(45deg);
  border-right: 1px solid #ead39a;
  border-bottom: 1px solid #ead39a;
  background: #fff9e8;
}

.farm-status-icon .tooltip::after {
  left: 14px;
  top: 0;
  transform: translateY(-5px) rotate(45deg);
  border-right: 0;
  border-bottom: 0;
  border-left: 1px solid #ead39a;
  border-top: 1px solid #ead39a;
}

.booking-warning .tooltip::after {
  left: 86px;
}

.booking-warning:hover .tooltip,
.booking-warning:focus .tooltip {
  opacity: 1;
  transform: translateY(0);
}

.farm-status-icon:hover .tooltip,
.farm-status-icon:focus .tooltip {
  opacity: 1;
  transform: translateY(0);
}

.marker-wrap {
  position: relative;
  width: 42px;
  height: 46px;
}

.leaflet-marker-icon.is-selected-marker {
  z-index: 2000 !important;
}

.marker-pin {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 46px;
  padding-bottom: 8px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.marker-wrap .marker-pin {
  position: absolute;
  left: 0;
  top: 0;
}

.marker-shape {
  position: absolute;
  left: 0;
  top: 0;
  width: 42px;
  height: 46px;
  fill: rgba(255, 255, 255, 0.97);
  stroke: #d5ded7;
  stroke-width: 1.5;
  stroke-linejoin: round;
  transition: fill 0.12s ease, stroke 0.12s ease;
}

.marker-icon {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  filter: none;
}

.marker-icon.twemoji-icon {
  width: 24px;
  height: 24px;
}

.marker-pin.is-paused {
  filter: grayscale(0.85);
  opacity: 0.78;
}

.marker-pin.is-paused .marker-shape {
  opacity: 0.9;
}

.leaflet-marker-icon.is-selected-marker .marker-shape {
  fill: color-mix(in srgb, var(--marker-color, #7a9b52) 36%, white);
  stroke: color-mix(in srgb, var(--marker-color, #7a9b52) 62%, #ffffff);
}

.rating-star {
  width: 12px;
  height: 12px;
  fill: var(--sun);
  stroke: #9a6914;
  stroke-width: 1.4;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

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

.leaflet-popup-content {
  margin: 12px 14px;
  font-family: "Lato", sans-serif;
}

.popup-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 800;
}

.popup-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 860px) {
  .utility-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    white-space: normal;
  }

  .quick-filter-bar,
  .controls-row {
    justify-content: flex-start;
  }

  .farm-search {
    width: 420px;
    max-width: none;
  }

  .map-shell {
    min-height: 0;
  }

  .farm-panel {
    top: auto;
    left: 16px;
    right: 16px;
    bottom: 18px;
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    max-height: 44%;
  }
}

@media (max-width: 560px) {
  .berry-top {
    padding: 14px 12px;
  }

  .quick-filter-bar,
  .controls-row {
    gap: 6px;
  }

  .berry-chip {
    flex: 0 0 auto;
    justify-content: center;
  }

}
