* {
  box-sizing: border-box;
}

:root {
  --purple: #6c47f7;
  --purple-dark: #5a35e8;
  --purple-soft: #efebfe;
  --text: #191734;
  --muted: #8a87a8;
  --card-shadow: 0 6px 22px rgba(84, 70, 160, 0.08);
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background-color: #f3f1fd;
  background-image: radial-gradient(#ddd8f6 1.2px, transparent 1.2px);
  background-size: 24px 24px;
  color: var(--text);
}

.appShell {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 24px 20px 32px;
}

.topBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  background: #ffffff;
  border-radius: 20px;
  padding: 18px 22px;
  box-shadow: var(--card-shadow);
}

.topBarLeft {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.backBtn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: #f4f3fb;
  color: #3b3860;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.backBtn:hover {
  background: #eceafb;
}

.topBarTitles {
  min-width: 0;
}

.topBarTitles h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.rideIdText {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.accent {
  color: var(--purple);
  font-weight: 600;
}

.liveBadge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.liveDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.8);
  }
}

.dashboardLayout {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.detailsCol {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.card {
  background: #ffffff;
  border-radius: 18px;
  box-shadow: var(--card-shadow);
}

.statusCard {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
}

.statusIcon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--purple-soft);
  color: var(--purple);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.statusInfo {
  flex: 1;
  min-width: 0;
}

.statusInfo h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.rideIdCard {
  margin: 3px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.personCard {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--purple-soft);
  color: var(--purple);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.personInfo {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fieldLabel {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}

.personInfo strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: normal;
  overflow-wrap: anywhere;
}

.phonePill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #eceaf8;
  box-shadow: 0 2px 8px rgba(84, 70, 160, 0.06);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--purple);
  max-width: 100%;
}

.phonePill strong {
  font-size: 12.5px;
  font-weight: 600;
  color: #3b3860;
  white-space: normal;
  overflow-wrap: anywhere;
}

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

.statCard {
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.statIcon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--purple-soft);
  color: var(--purple);
  display: grid;
  place-items: center;
}

.statLabel {
  margin-top: 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.statValue {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.statusBadge {
  margin-top: 6px;
  display: inline-flex;
  align-items: flex-start;
  gap: 5px;
  background: var(--purple-soft);
  color: var(--purple);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.3;
  max-width: 100%;
}

.statusBadge strong {
  font-weight: 700;
  white-space: normal;
  overflow-wrap: anywhere;
}

.badgeDot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--purple);
  flex-shrink: 0;
  margin-top: 4px;
}

.warningBanner {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eeebfe;
  border-radius: 16px;
  padding: 14px 16px;
}

.warningBanner p {
  margin: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: #6a63a8;
}

.infoIcon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--purple);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.panel {
  background: #ffffff;
  border-radius: 18px;
  box-shadow: var(--card-shadow);
}

.mapPanel {
  padding: 10px;
  min-width: 0;
}

#map {
  width: 100%;
  height: calc(100vh - 250px);
  min-height: 540px;
  border-radius: 12px;
  overflow: hidden;
}

.error {
  color: #c62828;
  margin: 14px 0 0;
  min-height: 20px;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.emptyState {
  margin-top: 16px;
  background: #ffffff;
  border-radius: 18px;
  padding: 36px 24px;
  text-align: center;
  box-shadow: var(--card-shadow);
}

.emptyState h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.emptyState p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

  .detailsCol {
    max-width: none;
  }

  #map {
    height: 480px;
    min-height: 0;
  }

  .warningBanner {
    margin-top: 0;
  }
}

@media (max-width: 700px) {
  .appShell {
    padding: 18px 14px 28px;
  }

  .topBar {
    padding: 16px 18px;
  }

  .topBarTitles h1 {
    font-size: 20px;
  }

  #map {
    height: 420px;
  }
}

@media (max-width: 560px) {
  .appShell {
    padding: 14px 12px 24px;
  }

  .topBar {
    padding: 14px 16px;
    gap: 10px;
  }

  .topBarTitles h1 {
    font-size: 18px;
  }

  .backBtn {
    width: 38px;
    height: 38px;
  }

  .liveBadge {
    padding: 8px 14px;
    font-size: 12px;
  }

  .statusCard,
  .personCard {
    padding: 14px;
    gap: 10px;
  }

  .statusIcon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .avatar {
    width: 38px;
    height: 38px;
  }

  .personCard {
    flex-wrap: wrap;
  }

  .personInfo {
    flex: 1 1 calc(100% - 48px);
  }

  .phonePill {
    flex: 1 1 100%;
    justify-content: flex-start;
    margin-left: 48px;
    box-sizing: border-box;
    width: auto;
  }

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

  .statCard {
    padding: 12px;
  }

  .statValue {
    font-size: 15px;
  }

  .warningBanner {
    padding: 12px 14px;
    align-items: flex-start;
  }

  .infoIcon {
    margin-top: 1px;
  }

  #map {
    height: 380px;
  }
}

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

  .phonePill {
    margin-left: 0;
    justify-content: center;
  }

  #map {
    height: 340px;
  }
}
