:root {
  --bg-top: #eef8f7;
  --bg-bottom: #fff8ef;
  --card: rgba(255, 255, 255, 0.9);
  --ink: #18322f;
  --muted: #5a7671;
  --accent: #22c8c1;
  --accent-deep: #0f8c92;
  --border: rgba(24, 50, 47, 0.1);
  --shadow: 0 22px 60px rgba(17, 43, 43, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(34, 200, 193, 0.22), transparent 30%),
    radial-gradient(circle at right 20%, rgba(255, 212, 138, 0.24), transparent 24%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body {
  min-height: 100vh;
}

.page-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.hero-card,
.map-card,
.info-panel {
  backdrop-filter: blur(12px);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-radius: 28px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-deep);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.95;
}

.hero-text {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.status-pill {
  min-width: 170px;
  text-align: center;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(24, 50, 47, 0.08);
  color: var(--ink);
  font-weight: 700;
}

.status-pill.is-hidden {
  display: none;
}

.status-pill.online {
  background: rgba(34, 200, 193, 0.18);
  color: #07646d;
}

.status-pill.offline {
  background: rgba(255, 188, 74, 0.22);
  color: #915d00;
}

.status-pill.error {
  background: rgba(221, 88, 88, 0.18);
  color: #8b1e1e;
}

.refresh-button {
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #22c8c1, #0f8c92);
  color: white;
  font: inherit;
  font-weight: 700;
  padding: 13px 18px;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(15, 140, 146, 0.28);
}

.refresh-button:hover {
  transform: translateY(-1px);
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.8fr);
  gap: 20px;
}

.map-card {
  position: relative;
  border-radius: 30px;
  overflow: hidden;
  min-height: 72vh;
}

#map {
  height: 100%;
  min-height: 72vh;
}

.info-panel {
  border-radius: 30px;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.metric-card {
  border-radius: 22px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(24, 50, 47, 0.06);
}

.metric-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-value {
  display: block;
  font-size: 1.05rem;
  line-height: 1.3;
}

.panel-note {
  margin: 2px 4px 0;
  color: var(--muted);
  line-height: 1.5;
}

.vehicle-marker {
  position: relative;
  width: 92px;
  height: 64px;
}

.vehicle-pulse {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(34, 200, 193, 0.32);
  animation: pulse 1.8s ease-out infinite;
}

.vehicle-marker img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(10, 50, 58, 0.28));
}

.leaflet-popup-content-wrapper {
  border-radius: 18px;
}

.popup-title {
  margin: 0 0 8px;
  font-size: 1rem;
}

.popup-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.85;
  }

  100% {
    transform: translate(-50%, -50%) scale(2.2);
    opacity: 0;
  }
}

@media (max-width: 980px) {
  .hero-card,
  .map-layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero-actions {
    align-items: stretch;
  }

  .map-card,
  #map {
    min-height: 58vh;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 18px, 100%);
    padding-top: 16px;
    padding-bottom: 18px;
  }

  .hero-card,
  .info-panel {
    border-radius: 24px;
    padding: 18px;
  }

  .map-card {
    border-radius: 24px;
  }
}
