.gps-map-module {
  margin: 0;
  padding: 20px 22px 18px;
  border: 1px solid #dbe3ed;
  border-radius: 18px;
  background: rgba(255,255,255,.95);
  box-shadow: 0 12px 34px rgba(25,50,80,.06);
}

.gps-map-shell {
  height: 100%;
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.gps-map-viewport {
  position: relative;
  width: 100%;
  height: clamp(320px, 27vw, 400px);
  min-height: 320px;
  overflow: hidden;
  overscroll-behavior: contain;
  border: 1px solid #cbd9e8;
  border-radius: 16px;
  background: linear-gradient(145deg, #dfeaf6, #f2f7fb);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), 0 12px 30px rgba(31,64,99,.11);
}

.gps-native-map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #dfeaf4;
}

.gps-native-map .leaflet-control-zoom {
  border: 0;
  box-shadow: 0 8px 24px rgba(17, 42, 72, .16);
}

.gps-native-map .leaflet-control-zoom a {
  color: #244866;
  border-color: #d9e4ef;
}

.gps-car-marker {
  min-width: 44px;
  transform: translate(-50%, -50%);
  color: #fff;
  filter: drop-shadow(0 7px 10px rgba(16,45,75,.27));
}

.gps-car-marker-core {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 96px;
  padding: 3px 5px 3px 4px;
  border: 1.5px solid #fff;
  border-radius: 999px;
  background: linear-gradient(135deg,#1678e9,#1155b3);
  box-shadow: 0 4px 12px rgba(18,88,165,.24);
}

.gps-car-marker.is-stale .gps-car-marker-core { background: linear-gradient(135deg,#ef9d24,#c46b10); }
.gps-car-marker.is-driving .gps-car-marker-core { background: linear-gradient(135deg,#18a980,#087a60); }
.gps-car-marker.is-not-started .gps-car-marker-core { background: linear-gradient(135deg,#4d86dc,#2f61ad); }
.gps-car-marker.is-stationary .gps-car-marker-core,
.gps-car-marker.is-started-stationary .gps-car-marker-core { background: linear-gradient(135deg,#eea72e,#bd7010); }
.gps-car-marker.is-unknown .gps-car-marker-core { background: linear-gradient(135deg,#8d7bc2,#655394); }
.gps-car-marker.is-offline .gps-car-marker-core { background: linear-gradient(135deg,#8192a5,#5e7184); }
.gps-car-marker svg { width: 12px; height: 12px; flex: 0 0 auto; }
.gps-car-marker span { overflow: hidden; font: 700 8px/1.15 system-ui,sans-serif; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }

.gps-map-loading,
.gps-map-setup {
  position: absolute;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.gps-map-loading {
  pointer-events: none;
  color: #5f7389;
  font-size: 12px;
  background: linear-gradient(145deg,rgba(231,239,248,.94),rgba(247,250,253,.94));
  transition: opacity .25s, visibility .25s;
}

.gps-map-loading::before {
  content: '';
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border: 2px solid #a8bed6;
  border-top-color: #2675e8;
  border-radius: 50%;
  animation: gps-spin .8s linear infinite;
}

.gps-map-loading.is-ready { opacity: 0; visibility: hidden; }
.gps-map-tile-error {
  position: absolute;
  z-index: 650;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100% - 24px);
  padding: 8px 9px 8px 11px;
  border: 1px solid rgba(185,113,14,.25);
  border-radius: 10px;
  color: #7b4a0b;
  background: rgba(255,249,235,.94);
  box-shadow: 0 8px 24px rgba(89,56,12,.16);
  font-size: 10px;
}
.gps-map-tile-error[hidden] { display: none; }
.gps-map-tile-error button { flex: 0 0 auto; padding: 5px 8px; border: 0; border-radius: 7px; color: #fff; background: #c77814; font: 700 10px/1 sans-serif; cursor: pointer; }
.gps-map-setup { background: radial-gradient(circle at 80% 12%,rgba(38,125,210,.28),transparent 34%),linear-gradient(145deg,rgba(7,25,46,.9),rgba(10,53,77,.86)); backdrop-filter: blur(7px); }
.gps-map-setup[hidden] { display: none; }
.gps-map-setup-card { width: min(390px,94%); padding: 22px; border: 1px solid rgba(255,255,255,.17); border-radius: 17px; color: #eaf4ff; background: rgba(7,25,45,.87); box-shadow: 0 18px 48px rgba(1,12,27,.34); }
.gps-map-setup-card strong { display: block; font-size: 16px; }
.gps-map-setup-card > p { margin: 7px 0 15px; color: rgba(223,236,250,.7); font-size: 11px; line-height: 1.7; }
.gps-map-setup-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.gps-map-setup-form input { min-width: 0; height: 36px; padding: 0 10px; border: 1px solid rgba(173,200,228,.28); border-radius: 9px; outline: 0; color: #edf7ff; background: rgba(255,255,255,.08); }
.gps-map-setup-form input:focus { border-color: #4ba5ff; box-shadow: 0 0 0 3px rgba(75,165,255,.13); }
.gps-map-setup-form button { min-height: 36px; padding: 0 13px; border: 0; border-radius: 9px; color: #fff; background: linear-gradient(135deg,#2b82ff,#1765d8); font: 700 11px/1 sans-serif; cursor: pointer; }
.gps-map-setup-form button:disabled { opacity: .6; cursor: wait; }
.gps-map-setup-note { min-height: 16px; margin-top: 9px; color: #9fb4c9; font-size: 10px; }
.gps-map-setup-note.error { color: #ff9da6; }

.gps-map-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 0 2px; }
.gps-map-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.gps-map-title strong { display: block; color: #172337; font-size: 14px; }
.gps-map-title small { display: block; margin-top: 2px; color: #7b8ba1; font-size: 10px; font-weight: 500; letter-spacing: .03em; }
.gps-map-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.gps-map-action { appearance: none; height: 30px; padding: 0 10px; border: 1px solid #cfdae8; border-radius: 8px; color: #39536f; background: #fff; font: 600 11px/1 sans-serif; cursor: pointer; transition: .18s ease; }
.gps-map-action:hover { border-color: #77a7eb; color: #145ecc; background: #f5f9ff; }
.gps-map-action[hidden] { display: none; }
.gps-map-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; color: #8493a5; font-size: 10px; }
.gps-map-attribution { color: inherit; text-decoration: none; opacity: .62; }
.gps-map-attribution:hover { opacity: 1; text-decoration: underline; }
.gps-map-status { display: inline-flex; align-items: center; gap: 6px; color: #2b7666; }
.gps-map-status::before { content: ''; width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: #23b693; box-shadow: 0 0 0 4px rgba(35,182,147,.12); }
.gps-map-status.is-warning { color: #a85f11; }
.gps-map-status.is-warning::before { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.13); }
.gps-map-status.is-error { color: #c2414d; }
.gps-map-status.is-error::before { background: #e44956; box-shadow: 0 0 0 4px rgba(228,73,86,.13); }

body.finance-dashboard-hidden .gps-map-module.finance-replacement-map .gps-map-viewport {
  height: clamp(245px, 22vw, 290px);
  min-height: 245px;
}

.gps-popup { min-width: 155px; color: #1b3249; }
.gps-popup strong { display: block; margin-bottom: 5px; font-size: 13px; }
.gps-popup span { display: block; margin-top: 3px; color: #657b90; font-size: 10px; }

@keyframes gps-spin { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
  .gps-map-module { padding: 14px; border-radius: 16px; }
  .gps-map-viewport { height: 360px; min-height: 360px; }
  .gps-map-head { align-items: flex-start; flex-direction: column; }
  .gps-map-actions { width: 100%; }
  .gps-map-action { flex: 1; }
  .gps-map-setup-form { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .gps-map-loading::before { animation-duration: 1.6s; }
}
