:root {
  color-scheme: light;
  --ink: #15322f;
  --muted: #64746f;
  --paper: #fbfff9;
  --panel: #ffffff;
  --line: #d8e7df;
  --forest: #18705e;
  --leaf: #68b044;
  --water: #0f8bb3;
  --sun: #f0bd3f;
  --danger: #b44a3a;
  --shadow: 0 18px 50px rgba(21, 50, 47, 0.16);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(104, 176, 68, 0.18), rgba(15, 139, 179, 0.11)),
    var(--paper);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.topbar {
  min-height: 76px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(251, 255, 249, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  z-index: 1000;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #d9f4ff, var(--water) 58%, var(--forest));
  color: #fff;
  box-shadow: 0 8px 22px rgba(15, 139, 179, 0.22);
}

.brand-drop {
  width: 17px;
  height: 23px;
  display: block;
  border-radius: 70% 30% 65% 35%;
  background: #fff;
  transform: rotate(45deg) translate(-1px, -1px);
  box-shadow: inset -3px -3px 0 rgba(15, 139, 179, 0.18);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--forest);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.08;
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

select,
.icon-button {
  min-height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  font-weight: 800;
}

select {
  padding: 0 10px;
}

.icon-button {
  width: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.locate-symbol {
  font-size: 1.55rem;
  line-height: 1;
}

.icon-button:hover,
.icon-button.active {
  border-color: var(--forest);
  background: #e9f7ee;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-rows: minmax(340px, 58vh) minmax(320px, 42vh);
  min-height: 0;
}

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

#map {
  position: absolute;
  inset: 0;
  background: #dfe9e4;
}

.map-status {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  z-index: 500;
  padding: 10px 12px;
  border: 1px solid rgba(216, 231, 223, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}

.station-panel {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.panel-header {
  padding: 16px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2 {
  margin: 0;
  font-size: 1.25rem;
}

.count-pill {
  min-width: 44px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #e8f6f1;
  color: var(--forest);
  font-weight: 900;
  text-align: center;
}

.search-row {
  padding: 0 16px 12px;
}

.search-row input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fcf9;
  color: var(--ink);
  outline: none;
}

.search-row input:focus {
  border-color: var(--water);
  box-shadow: 0 0 0 3px rgba(15, 139, 179, 0.13);
}

.selected-station {
  padding: 0 16px 12px;
}

.station-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 10px 18px;
}

.station-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 12px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.station-item:hover,
.station-item.active {
  background: #f2faf6;
}

.station-item strong {
  display: block;
  font-size: 0.97rem;
}

.station-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.83rem;
}

.distance {
  color: var(--water);
  font-weight: 900;
  white-space: nowrap;
}

.detail-card {
  position: relative;
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #f5fbf8);
  box-shadow: 0 12px 28px rgba(21, 50, 47, 0.11);
}

.close-detail {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(21, 50, 47, 0.08);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
}

.detail-media {
  min-height: 110px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 139, 179, 0.28), rgba(104, 176, 68, 0.24)),
    #e7f3ed;
  overflow: hidden;
}

.detail-media img {
  width: 100%;
  height: 100%;
  min-height: 110px;
  display: block;
  object-fit: cover;
}

.detail-media .fallback {
  height: 100%;
  min-height: 110px;
  display: grid;
  place-items: center;
  color: var(--forest);
  font-size: 2rem;
  font-weight: 900;
}

.detail-content {
  padding-right: 22px;
}

.detail-content h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  line-height: 1.18;
}

.detail-address {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.86rem;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tag {
  padding: 5px 7px;
  border-radius: 999px;
  background: #eef8f3;
  color: var(--forest);
  font-size: 0.73rem;
  font-weight: 800;
}

.tag.warning {
  background: #fff7e3;
  color: #8a610b;
}

.navigate-button {
  width: fit-content;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--forest);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 900;
  text-decoration: none;
}

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

.popup-card {
  width: 210px;
}

.popup-card img {
  width: 100%;
  height: 112px;
  border-radius: 8px;
  object-fit: cover;
  background: #e7f3ed;
}

.popup-card h3 {
  margin: 8px 0 8px;
  font-size: 0.98rem;
}

.popup-card a {
  color: var(--forest);
  font-weight: 900;
}

.custom-marker {
  width: 20px;
  height: 20px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: var(--water);
  box-shadow: 0 3px 10px rgba(21, 50, 47, 0.35);
  transform: rotate(-45deg);
}

.custom-marker::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--leaf);
}

.user-marker {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #0000ff;
  box-shadow: 0 0 0 7px rgba(0, 0, 255, 0.24);
}

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

.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;
}

@media (min-width: 850px) {
  .topbar {
    padding: 14px 22px;
  }

  h1 {
    font-size: 1.45rem;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) 410px;
    grid-template-rows: minmax(0, calc(100vh - 76px));
  }

  .map-panel,
  .station-panel {
    min-height: 0;
  }

  .station-panel {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .map-status {
    left: 18px;
    right: auto;
    max-width: 420px;
  }
}
