:root {
  color-scheme: dark;
  --bg: #101314;
  --panel: #181d1f;
  --panel-2: #20272a;
  --text: #edf2f1;
  --muted: #94a2a0;
  --line: #2d383a;
  --green: #42d392;
  --amber: #e7b94f;
  --red: #ee6b6e;
  --cyan: #6dcff6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 760;
}

h2 {
  font-size: 15px;
  font-weight: 720;
}

#subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.status-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  min-width: 86px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.pill.ok {
  border-color: rgba(66, 211, 146, 0.45);
  color: var(--green);
}

.pill.warn {
  border-color: rgba(231, 185, 79, 0.45);
  color: var(--amber);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.stage {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
}

.stage span {
  width: 10px;
  height: 10px;
  margin-right: 9px;
  border-radius: 50%;
  background: #526164;
}

.stage.active {
  color: var(--text);
  border-color: rgba(66, 211, 146, 0.42);
}

.stage.active span {
  background: var(--green);
  box-shadow: 0 0 14px rgba(66, 211, 146, 0.65);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 14px;
  min-height: calc(100vh - 142px);
}

.map-area {
  position: relative;
  min-height: 620px;
  border: 1px solid var(--line);
  background: #0b0e0f;
}

.map-action {
  position: absolute;
  z-index: 500;
  top: 12px;
  right: 12px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(66, 211, 146, 0.48);
  border-radius: 6px;
  background: rgba(16, 19, 20, 0.88);
  color: var(--green);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.map-action:active {
  transform: translateY(1px);
}

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

.side {
  display: grid;
  gap: 12px;
  align-content: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 14px;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metrics div {
  padding: 12px;
  border-radius: 4px;
  background: var(--panel-2);
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.quality-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

#satCount {
  color: var(--muted);
  font-size: 13px;
}

#networkUpdated {
  color: var(--muted);
  font-size: 13px;
}

.sat-bars {
  display: grid;
  gap: 7px;
  max-height: 210px;
  overflow: auto;
}

.sat {
  display: grid;
  grid-template-columns: 58px 1fr 38px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.bar {
  height: 9px;
  border-radius: 999px;
  background: #2b3335;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--amber), var(--green), var(--cyan));
}

.signal-meter {
  display: grid;
  gap: 9px;
  margin: 12px 0 4px;
  padding: 12px;
  border-radius: 4px;
  background: var(--panel-2);
}

.signal-meter span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.signal-meter strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.signal.bar {
  height: 12px;
}

.network dd {
  overflow-wrap: anywhere;
}

dl {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 9px 12px;
  margin: 12px 0 0;
  font-size: 13px;
}

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

dd {
  margin: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.log pre {
  width: 100%;
  max-width: 100%;
  height: 180px;
  margin: 12px 0 0;
  overflow: auto;
  color: #c8d5d3;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.leaflet-container {
  background: #0b0e0f;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .timeline,
  .layout {
    grid-template-columns: 1fr;
  }

  .map-area,
  #map {
    min-height: 430px;
  }
}

@media (max-width: 520px) {
  .shell {
    padding: 12px;
  }

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