/* Minimal Leaflet layout fallback.
   If the CDN stylesheet is blocked, these rules keep map panes and tiles
   positioned correctly instead of rendering as scattered inline images. */
.leaflet-container {
  overflow: hidden;
  background: #dce9ef;
  outline-offset: 1px;
}

.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-container img {
  max-width: none !important;
}

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

.leaflet-top {
  top: 0;
}

.leaflet-right {
  right: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;
}

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

.leaflet-left .leaflet-control {
  margin-left: 10px;
}

.leaflet-top .leaflet-control {
  margin-top: 10px;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  color: #1d2528;
}

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

.sidebar {
  border-right: 1px solid #d8dedb;
  padding: 22px;
  overflow-y: auto;
  background: #f8faf8;
}

h1 {
  font-size: 23px;
  line-height: 1.18;
  margin: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
}

.atlas-logo {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #56615f;
  margin-top: 24px;
}

.lede, .note, .links {
  font-size: 13px;
  line-height: 1.45;
  color: #50605d;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 16px 0 6px;
  padding: 4px;
  border: 1px solid #d5ded9;
  border-radius: 7px;
  background: #edf3f0;
}

.mode-toggle button {
  border: 0;
  border-radius: 5px;
  padding: 9px 8px;
  background: transparent;
  color: #4f5c5a;
  font-weight: 700;
  cursor: pointer;
}

.mode-toggle button.active {
  background: #fff;
  color: #15201f;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.metrics div {
  background: #fff;
  border: 1px solid #dce4e0;
  border-radius: 6px;
  padding: 10px;
}

.metrics span {
  display: block;
  font-size: 20px;
  font-weight: 700;
}

.metrics label {
  font-size: 11px;
  color: #61716e;
}

select {
  width: 100%;
  margin: 6px 0 14px;
  padding: 9px;
  border: 1px solid #cbd5d1;
  border-radius: 5px;
  background: #fff;
}

input,
textarea {
  box-sizing: border-box;
  width: 100%;
  margin: 6px 0 14px;
  padding: 9px;
  border: 1px solid #cbd5d1;
  border-radius: 5px;
  background: #fff;
  color: #1d2528;
  font: inherit;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

button {
  font: inherit;
}

.research-tools {
  border-top: 1px solid #dce4e0;
  margin-top: 22px;
}

.follow-tools {
  border-top: 1px solid #dce4e0;
  margin-top: 22px;
}

.follow-tools p {
  margin: 0 0 10px;
  color: #50605d;
  font-size: 12px;
  line-height: 1.45;
}

.follow-links {
  display: grid;
  gap: 7px;
}

.follow-links a {
  color: #17635e;
  font-size: 13px;
  font-weight: 700;
}

.tool-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.tool-actions button:last-child {
  grid-column: 1 / -1;
}

.tool-actions button,
.dialog-actions button {
  min-height: 38px;
  border: 1px solid #24736d;
  border-radius: 5px;
  padding: 8px 10px;
  background: #24736d;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.tool-actions button:hover,
.dialog-actions button:hover {
  background: #185a56;
}

.consent-control {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 6px;
  color: #465553;
  font-size: 12px;
  line-height: 1.35;
}

.consent-control input {
  width: auto;
  margin: 2px 0 0;
}

.microcopy {
  margin: 0;
  color: #62716e;
  font-size: 11px;
  line-height: 1.4;
}

.metrics-link {
  display: inline-block;
  margin-top: 7px;
  color: #17635e;
  font-size: 12px;
  font-weight: 700;
}

.method-card {
  margin-top: 14px;
  border: 1px solid #dce4e0;
  border-radius: 5px;
  background: #fff;
}

.method-card summary {
  cursor: pointer;
  padding: 9px;
  color: #364542;
  font-size: 12px;
  font-weight: 700;
}

.manifest-details {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 10px 10px;
}

.manifest-details div {
  display: grid;
  gap: 2px;
}

.manifest-details dt {
  color: #5a6966;
  font-size: 11px;
  font-weight: 700;
}

.manifest-details dd {
  margin: 0;
  color: #364542;
  font-size: 11px;
  line-height: 1.35;
}

dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border: 1px solid #cbd5d1;
  border-radius: 7px;
  padding: 0;
  color: #1d2528;
  box-shadow: 0 18px 50px rgba(22, 37, 34, 0.24);
}

dialog::backdrop {
  background: rgba(19, 31, 29, 0.44);
}

dialog form {
  padding: 20px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.dialog-heading h2 {
  margin: 0 0 6px;
  color: #1d2528;
  font-size: 17px;
  letter-spacing: 0;
  text-transform: none;
}

.dialog-heading p {
  margin: 0;
  color: #5a6966;
  font-size: 12px;
  line-height: 1.45;
}

.icon-button {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #42514e;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.dialog-actions .secondary-button {
  border-color: #b9c5c1;
  background: #fff;
  color: #40504d;
}

main {
  position: relative;
  min-width: 0;
}

#map {
  height: 100%;
  width: 100%;
}

#count-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 500;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d8dedb;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 650;
}

.state-list {
  display: grid;
  gap: 7px;
}

.state-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: #23706b;
}

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

.popup-grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 12px;
  font-size: 12px;
}

@media (max-width: 760px) {
  html,
  body {
    height: auto;
    min-height: 100%;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(560px, 66vh);
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid #d8dedb;
    overflow: visible;
  }

  main,
  #map {
    min-height: 560px;
  }

  #count-badge {
    top: 12px;
    right: 12px;
  }
}
