:root {
  --bg: #f4f7f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #5c6b73;
  --line: #d8e0e3;
  --accent: #0f766e;
  --accent-soft: #e1f3f1;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  height: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
  margin-bottom: 12px;
}

#summary {
  color: var(--muted);
  font-size: 14px;
  margin-top: 5px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.check-filter {
  min-height: 38px;
  display: flex;
  align-items: center;
  grid-template-columns: none;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-transform: none;
}

.check-filter input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

select {
  min-width: 160px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
}

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

#map {
  height: 100%;
  min-height: 0;
}
.leaflet-container {
  height: 100% !important;
  width: 100% !important;
}

.panel {
  overflow: auto;
  padding: 18px;
  background: var(--panel);
  border-left: 1px solid var(--line);
}

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

.plant-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  cursor: pointer;
}

.plant-card:hover,
.plant-card:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(15, 118, 110, 0.14);
}

.plant-card strong {
  display: block;
  font-size: 14px;
  line-height: 1.35;
}

.plant-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  margin-top: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
}

.badge-active {
  background: #dcfce7;
  color: #166534;
}

.badge-closed {
  background: #f3f4f6;
  color: #4b5563;
}

.source-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 22px;
  margin-top: 6px;
  padding: 0 8px;
  align-items: center;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 750;
}

.facility-marker {
  background: transparent;
}

.facility-marker span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 2px solid var(--marker-stroke);
  border-radius: 6px;
  background: var(--marker-fill);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.24);
}

.facility-marker.has-water span {
  border-radius: 50% 50% 50% 8px;
  transform: rotate(-45deg);
}

.facility-marker.has-water span::first-letter {
  transform: rotate(45deg);
}

.facility-marker.has-water span {
  color: transparent;
}

.facility-marker.has-water span::after {
  content: "W";
  color: #fff;
  transform: rotate(45deg);
}

.facility-marker:not(.has-factory):not(.has-water) span {
  border-radius: 50%;
}

.popup-title {
  font-weight: 750;
  margin-bottom: 4px;
}

.popup-meta {
  color: var(--muted);
}

@media (max-width: 820px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  #map {
    height: 100%;
    min-height: 0;
  }

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