:root {
  color-scheme: light;
  --ink: #1f2428;
  --muted: #5f686f;
  --line: #d9dedb;
  --panel: #fbfcf8;
  --map-bg: #e7ece6;
  --active: #d89222;
  --other: #8e6db3;
  --closed: #4f9b8f;
  --gold: #f2c94c;
  --gold-line: #6f5014;
  --public: #24784f;
  --warning: #b6632b;
  --blocked: #b33a32;
  --unknown: #6f7780;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--map-bg);
}

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  min-height: 100vh;
}

.panel {
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
  max-height: 100vh;
  overflow: auto;
  padding: 18px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: 0 10px 30px rgb(0 0 0 / 12%);
}

.panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.15;
}

.icon-button {
  min-height: 36px;
  padding: 0 12px;
  color: #fff;
  font-weight: 700;
  border: 0;
  border-radius: 6px;
  background: #2f6f5e;
  cursor: pointer;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.status-grid > div {
  min-height: 70px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
}

.metric-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.controls {
  display: grid;
  gap: 12px;
}

.search-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

input[type="search"] {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
}

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

.filter-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 0.86rem;
  cursor: pointer;
}

.legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: -1px;
}

.swatch--active {
  background: var(--active);
}

.swatch--other {
  background: var(--other);
}

.swatch--closed {
  background: var(--closed);
}

.swatch--gold {
  border: 1px solid var(--gold-line);
  border-radius: 50%;
  background: var(--gold);
}

.line {
  display: inline-block;
  width: 24px;
  height: 0;
  margin-right: 6px;
  border-top: 3px solid #343434;
  vertical-align: 4px;
}

.line--closed {
  border-top-color: var(--blocked);
  border-top-style: dashed;
}

.note {
  padding: 10px;
  color: #3b3a31;
  border: 1px solid #e2d6a8;
  border-radius: 8px;
  background: #fff8d8;
  font-size: 0.84rem;
  line-height: 1.35;
}

.results {
  display: flex;
  flex: 1;
  min-height: 220px;
  flex-direction: column;
  gap: 8px;
}

.results__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.claim-list {
  display: grid;
  gap: 8px;
}

.list-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.claim-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--unknown);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.claim-card h2 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  line-height: 1.2;
}

.claim-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.claim-card[data-access="appears_public_road_access"] {
  border-left-color: var(--public);
}

.claim-card[data-access="public_road_high_clearance"] {
  border-left-color: var(--warning);
}

.claim-card[data-access="likely_gated_or_closed"],
.claim-card[data-access="possible_private_crossing"] {
  border-left-color: var(--blocked);
}

.map-wrap {
  position: relative;
  min-width: 0;
  min-height: 100vh;
}

#map {
  width: 100%;
  height: 100vh;
  background: var(--map-bg);
}

.loading {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 700;
  transform: translateX(-50%);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 26px rgb(0 0 0 / 18%);
  font-size: 0.9rem;
}

.popup {
  min-width: 230px;
}

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

.popup dl {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 5px 10px;
  margin: 0;
}

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

.popup dd {
  margin: 0;
  font-weight: 650;
}

@media (max-width: 860px) {
  .layout {
    display: flex;
    min-height: 100dvh;
    flex-direction: column;
  }

  .panel {
    order: 2;
    min-height: auto;
    max-height: 42dvh;
    padding: 12px;
    gap: 10px;
    border-right: 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 26px rgb(0 0 0 / 12%);
  }

  .panel__header {
    align-items: center;
  }

  .eyebrow {
    font-size: 0.68rem;
  }

  h1 {
    font-size: 1.08rem;
  }

  .icon-button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .status-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .status-grid > div {
    min-height: 54px;
    padding: 7px;
  }

  .metric {
    font-size: 1rem;
  }

  .metric-label {
    font-size: 0.68rem;
  }

  .controls {
    gap: 8px;
  }

  .filter-group {
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .filter-group label {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 5px 8px;
    font-size: 0.78rem;
  }

  .legend,
  .note {
    display: none;
  }

  .results {
    min-height: 140px;
  }

  .claim-card {
    padding: 8px;
  }

  .claim-card h2 {
    font-size: 0.86rem;
  }

  .claim-card p {
    font-size: 0.74rem;
  }

  #map,
  .map-wrap {
    order: 1;
    height: 58dvh;
    min-height: 58dvh;
  }

  .leaflet-control-layers {
    font-size: 0.8rem;
  }

  .leaflet-popup-content {
    max-width: 250px;
  }
}
