body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: #0f1115;
  color: #e4e6eb;
}
header {
  padding: 16px 20px;
  background: #151922;
  border-bottom: 1px solid #222838;
}
header h1 {
  margin: 0 0 4px 0;
  font-size: 1.4rem;
}
header p {
  margin: 0;
  color: #a6adbb;
}
.header-link {
  color: #8ec7ff;
  font-weight: 600;
  text-decoration: none;
}
.header-link:hover {
  text-decoration: underline;
}
.instance-form {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.instance-form__label {
  font-size: 0.82rem;
  color: #b6bfce;
}
.instance-form input {
  min-width: 200px;
  height: 32px;
  border: 1px solid #374151;
  border-radius: 6px;
  background: #10151f;
  color: #e5e7eb;
  padding: 0 10px;
}
.instance-form button {
  height: 32px;
  border: 1px solid #1f2937;
  border-radius: 6px;
  padding: 0 12px;
  background: #f8fafc;
  color: #111827;
  font-weight: 600;
  cursor: pointer;
}
#instance-form-status {
  font-size: 0.82rem;
  margin-left: 4px;
}
.instance-form__status--ok {
  color: #86efac;
}
.instance-form__status--error {
  color: #fca5a5;
}
main {
  flex: 1;
  min-height: 0;
}
#map {
  height: 72vh;
  min-height: 420px;
  width: 100%;
}
.instances-panel {
  margin-top: 12px;
}
.instances-panel h2 {
  margin: 0 0 8px 0;
  font-size: 0.95rem;
  color: #d1d7e3;
}
.instances-panel__table-wrap {
  max-height: 180px;
  overflow: auto;
  border: 1px solid #2e374a;
  border-radius: 8px;
  background: #10151f;
}
.instances-panel__table-wrap--full {
  max-height: none;
}
.instances-main {
  padding: 16px 20px;
}
.instances-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.instances-table th,
.instances-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #293245;
}
.instances-table th {
  position: sticky;
  top: 0;
  background: #161d2a;
  color: #d5dbea;
  z-index: 1;
}
.instances-table tbody tr:last-child td {
  border-bottom: 0;
}
.leaflet-container {
  background: #10151f;
}
.node-popup {
  font-size: 0.9rem;
}
.node-dot-icon {
  background: transparent;
  border: 0;
}
.node-dot {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid #111827;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.node-count-legend {
  min-width: 150px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #ffffff;
  color: #111111;
  border: 1px solid #111111;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  font-size: 0.86rem;
  line-height: 1.35;
}
.node-count-legend__title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.channel-legend {
  min-width: 160px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #ffffff;
  color: #111111;
  border: 1px solid #111111;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
.channel-legend__title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
  color: #111111;
}
.channel-legend__row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  text-transform: capitalize;
  color: #111111;
}
.channel-legend__row + .channel-legend__row {
  margin-top: 5px;
}
.channel-legend__swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid #111111;
  flex: 0 0 14px;
}

/* Improve cluster-count readability over dense map tiles. */
.marker-cluster div {
  color: #111111;
}

@media (max-width: 900px) {
  .instance-form input {
    min-width: 160px;
    flex: 1 1 220px;
  }
  .instances-panel__table-wrap {
    max-height: 140px;
  }
  #map {
    height: 62vh;
    min-height: 320px;
  }
}

.instances-table a {
  color: #ffffff;
}
.instances-table a:hover {
  color: #dbeafe;
}
