* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f3f5f7;
  color: #18212b;
}

body {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 14px 20px;
  background: #18212b;
  color: white;
}

header h1 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

header p {
  margin: 0;
  opacity: 0.78;
  font-size: 0.9rem;
}

#updated {
  white-space: nowrap;
  font-size: 0.85rem;
  opacity: 0.85;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  background: white;
  border-bottom: 1px solid #d7dde3;
}

.controls input[type="search"] {
  min-width: 280px;
  flex: 1;
}

.controls input,
.controls select,
.controls button {
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #bfc8d1;
  border-radius: 5px;
  background: white;
}

.controls button {
  cursor: pointer;
  font-weight: 600;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 1px;
  background: #d7dde3;
  border-bottom: 1px solid #d7dde3;
}

.stats div {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
  padding: 8px;
  background: #f8fafb;
}

.stats strong {
  font-size: 1.15rem;
}

.stats span {
  font-size: 0.78rem;
  color: #52606d;
}

main {
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 480px;
}

footer {
  padding: 7px 14px;
  font-size: 0.75rem;
  background: #18212b;
  color: #dce3ea;
  text-align: center;
}

.popup h3 {
  margin: 0 0 8px;
}

.popup table {
  border-collapse: collapse;
  font-size: 0.85rem;
}

.popup th,
.popup td {
  text-align: left;
  vertical-align: top;
  padding: 2px 5px 2px 0;
}

.popup p {
  margin-bottom: 0;
  max-width: 320px;
}

@media (max-width: 760px) {
  header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .controls input[type="search"] {
    min-width: 100%;
  }
}
