:root {
  color-scheme: dark;
  --bg: #101214;
  --panel: #181c20;
  --panel-strong: #20262b;
  --text: #f5f7fa;
  --muted: #9aa4ad;
  --line: #2d363d;
  --accent: #35c98b;
  --warn: #f2b84b;
  --danger: #f06565;
}

* {
  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;
}

.app-shell {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-rows: auto auto minmax(360px, 1fr) auto;
  gap: 16px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  line-height: 1.08;
}

.status-pill {
  flex: 0 0 auto;
  min-width: 92px;
  padding: 9px 12px;
  border-radius: 999px;
  color: #07110d;
  background: var(--warn);
  font-weight: 800;
  text-align: center;
}

.status-pill.online {
  background: var(--accent);
}

.status-pill.offline {
  color: #1d0808;
  background: var(--danger);
}

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

.metric {
  min-width: 0;
  min-height: 82px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.25;
}

.map-panel {
  min-height: 360px;
  overflow: hidden;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.navigate-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 18px;
  border-radius: 8px;
  color: #07110d;
  background: var(--accent);
  font-weight: 900;
  text-decoration: none;
}

.navigate-button.disabled {
  pointer-events: none;
  color: var(--muted);
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.leaflet-container {
  background: #20262b;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
    grid-template-rows: auto auto 44vh auto;
  }

  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 420px) {
  .details-grid {
    grid-template-columns: 1fr;
  }
}
