:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #63706c;
  --line: #dbe4df;
  --paper: #fbfdfb;
  --panel: rgba(255, 255, 255, 0.94);
  --green: #2c7a62;
  --teal: #287a88;
  --amber: #b56d13;
  --red: #b44646;
  --shadow: 0 16px 40px rgba(29, 48, 43, 0.16);
}

/* Leaflet's core layout rules are kept locally so the map still renders if CDN CSS is blocked. */
.leaflet-container {
  overflow: hidden;
  background: #dfe8e4;
  outline-offset: 1px;
  font-family: inherit;
}

.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-container {
  -webkit-tap-highlight-color: transparent;
}

.leaflet-container img {
  max-width: none !important;
}

.leaflet-tile {
  width: 256px;
  height: 256px;
  user-select: none;
}

.leaflet-marker-icon,
.leaflet-marker-shadow {
  display: block;
}

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

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

.leaflet-top {
  top: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;
}

.leaflet-right {
  right: 0;
}

.leaflet-control-zoom {
  margin: 0 0 16px 16px;
  border: 1px solid rgba(23, 33, 31, 0.12);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.leaflet-control-zoom a + a {
  border-top: 1px solid var(--line);
}

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

.leaflet-popup-content-wrapper {
  padding: 1px;
  background: white;
  box-shadow: var(--shadow);
}

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

.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: -8px auto 0;
  background: white;
  transform: rotate(45deg);
  box-shadow: var(--shadow);
}

.leaflet-interactive {
  cursor: pointer;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow-x: hidden;
}

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

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  width: 100%;
  min-height: 100vh;
}

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

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

.map-topbar {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}

.map-topbar > * {
  min-width: 0;
  pointer-events: auto;
}

.map-topbar h1,
.map-topbar p {
  margin: 0;
}

.map-topbar h1 {
  margin-top: 2px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.eyebrow {
  color: #30574f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-topbar > div:first-child,
.summary {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 12px 14px;
}

.map-topbar > div:first-child {
  max-width: min(420px, calc(100vw - 124px));
}

.summary {
  min-width: 84px;
  text-align: center;
}

.summary span {
  display: block;
  color: var(--green);
  font-size: 26px;
  font-weight: 850;
  line-height: 1;
}

.summary small {
  color: var(--muted);
  font-size: 12px;
}

.sheet {
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 100vh;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--paper);
  padding: 18px;
  box-shadow: -16px 0 34px rgba(28, 46, 41, 0.08);
}

.sheet-handle {
  display: none;
}

.filters {
  display: grid;
  gap: 10px;
}

.search-box {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-box input,
#typeFilter {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.search-box input:focus,
#typeFilter:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(40, 122, 136, 0.13);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.segmented button {
  height: 38px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-weight: 800;
}

.segmented button.is-active {
  border-color: var(--green);
  background: #e9f5ef;
  color: var(--green);
}

.selected-panel,
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.selected-panel {
  min-height: 128px;
  padding: 14px;
}

.list {
  display: grid;
  gap: 10px;
}

.card {
  cursor: pointer;
  padding: 12px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.card:hover,
.card.is-selected {
  border-color: rgba(44, 122, 98, 0.55);
  box-shadow: 0 10px 24px rgba(29, 48, 43, 0.1);
  transform: translateY(-1px);
}

.card-head,
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card h2,
.detail h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #eef4f2;
  color: #315c52;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 750;
}

.rating {
  justify-content: center;
  min-width: 34px;
  color: white;
}

.rating-a {
  background: var(--green);
}

.rating-b {
  background: var(--amber);
}

.rating-c {
  background: var(--red);
}

.note,
.address,
.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.note {
  margin: 10px 0 0;
  color: #344541;
}

.address {
  margin: 8px 0 0;
}

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

.detail-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green);
  background: #f6faf8;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.detail-actions a.primary {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.empty {
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
}

.pin {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 3px solid white;
  border-radius: 50% 50% 50% 0;
  color: white;
  font-weight: 900;
  box-shadow: 0 6px 18px rgba(22, 34, 31, 0.24);
  transform: rotate(-45deg);
}

.pin span {
  transform: rotate(45deg);
}

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

.popup-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 850;
}

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

@media (max-width: 860px) {
  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .map-panel {
    min-height: 58vh;
  }

  .map-topbar {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .map-topbar h1 {
    font-size: 20px;
  }

  .summary {
    min-width: 68px;
  }

  .sheet {
    position: relative;
    max-height: none;
    margin-top: -18px;
    border: 0;
    border-radius: 16px 16px 0 0;
    padding: 12px 12px 20px;
  }

  .sheet-handle {
    display: block;
    width: 48px;
    height: 5px;
    margin: 0 auto 2px;
    border-radius: 999px;
    background: #c9d5d0;
  }

  .selected-panel {
    min-height: 118px;
  }
}
