:root {
  --bg: #0b1117;
  --panel: #111923;
  --panel-2: #162231;
  --text: #edf4f8;
  --muted: #91a4b7;
  --border: #263544;
  --blue: #38bdf8;
  --green: #22c55e;
  --teal: #14b8a6;
  --amber: #f59e0b;
  --red: #ef4444;
  --violet: #8b5cf6;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

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

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100vh;
  padding: 14px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow: auto;
  z-index: 600;
}

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

.brand-banner {
  width: 100%;
  aspect-ratio: 1600 / 420;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.brand-copy h1,
.panel h2 {
  margin: 0;
  line-height: 1.1;
}

.brand-copy h1 {
  font-size: 26px;
}

.brand-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

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

.metric,
.panel {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.metric {
  min-height: 74px;
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1;
}

.panel {
  padding: 13px;
}

.panel h2 {
  margin-bottom: 12px;
  font-size: 14px;
  text-transform: uppercase;
  color: #cbd8e4;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  color: #d7e2ea;
  font-size: 14px;
}

.toggle-row input {
  accent-color: var(--blue);
}

.operator-list {
  display: grid;
  gap: 6px;
  max-height: 286px;
  overflow: auto;
}

.operator-button {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0f1720;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.operator-button:hover,
.operator-button.active {
  border-color: #4e6f8a;
  background: #142131;
}

.operator-button .swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.operator-button .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operator-button .count {
  color: var(--muted);
  font-size: 12px;
}

.details-panel {
  margin-bottom: 8px;
}

.selection {
  color: #d7e2ea;
  font-size: 13px;
  line-height: 1.5;
}

.selection dl {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
}

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

.selection dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

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

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

#map {
  position: absolute;
  inset: 0;
  background: #071019;
}

.toolbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 550;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.toolbar-title {
  max-width: min(680px, 70vw);
  padding: 10px 12px;
  border: 1px solid rgba(38, 53, 68, 0.9);
  border-radius: 8px;
  background: rgba(17, 25, 35, 0.88);
  box-shadow: var(--shadow);
  color: #d7e2ea;
  font-size: 13px;
  pointer-events: auto;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.icon-link {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(38, 53, 68, 0.9);
  border-radius: 8px;
  background: rgba(17, 25, 35, 0.88);
  color: var(--text);
  box-shadow: var(--shadow);
}

.icon-link svg {
  width: 18px;
  height: 18px;
}

.legend {
  position: absolute;
  right: 14px;
  bottom: 22px;
  z-index: 550;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  max-width: 620px;
  padding: 10px 12px;
  border: 1px solid rgba(38, 53, 68, 0.9);
  border-radius: 8px;
  background: rgba(17, 25, 35, 0.88);
  color: #d7e2ea;
  box-shadow: var(--shadow);
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.coverage {
  background: var(--green);
}

.dot.pop {
  background: var(--blue);
}

.dot.gateway {
  background: var(--amber);
}

.line.orbit {
  display: inline-block;
  width: 22px;
  height: 2px;
  background: var(--violet);
}

.infra-marker,
.sat-marker {
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.18);
}

.infra-marker.pop {
  width: 14px;
  height: 14px;
  background: var(--blue);
}

.infra-marker.gateway {
  width: 12px;
  height: 12px;
  background: var(--amber);
}

.sat-marker {
  width: 13px;
  height: 13px;
  background: var(--violet);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #101923;
  color: var(--text);
  border: 1px solid var(--border);
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--muted);
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 72vh;
  }

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand {
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: center;
  }

  .operator-list {
    max-height: 160px;
  }

  .map-stage {
    min-height: 72vh;
  }
}

@media (max-width: 560px) {
  .sidebar {
    padding: 10px;
  }

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

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

  .toolbar {
    align-items: flex-start;
  }

  .toolbar-title {
    max-width: calc(100vw - 102px);
  }

  .legend {
    left: 10px;
    right: 10px;
    bottom: 12px;
  }
}
