:root {
  --bg: #1b1e2b;
  --card: #ffffff;
  --text: #1b1e2b;
  --muted: #6b7080;
  --voi: #ff6652;
  --bolt: #34bb78;
  --ryde: #39ff14;
  --me: #7cc4ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#map { position: absolute; inset: 0; }

/* Status pill (laster / zoom inn / feil) */
.status {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 22, 32, .88);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  white-space: nowrap;
  z-index: 5;
  pointer-events: none;
}

/* Tegnforklaring */
.legend {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 12px;
  display: flex;
  gap: 10px;
  background: rgba(20, 22, 32, .8);
  color: #e8e9ee;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  z-index: 4;
}
.legend span { display: flex; align-items: center; gap: 5px; }
.legend { user-select: none; -webkit-user-select: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.voi { background: var(--voi); }
.dot.bolt { background: var(--bolt); }
.dot.ryde { background: var(--ryde); }

/* Min posisjon-knapp */
.fab {
  position: absolute;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 24px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: var(--text);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  display: grid;
  place-items: center;
  z-index: 4;
}
.fab:active { transform: scale(.95); }

/* Min posisjon */
.me {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--me);
  border: 3px solid #fff;
  box-shadow: 0 0 0 8px rgba(124, 196, 255, .25);
}

/* Klynger: smultring med andel per leverandør */
.cluster {
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.cluster.no-pref { opacity: .7; }
.cluster-inner {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #262a3b;
  color: #fff;
  font-weight: 700;
  line-height: 1;
}
.cluster-inner small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
}

/* Detaljkort */
.sheet {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  background: var(--card);
  color: var(--text);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
  z-index: 6;
  max-width: 480px;
  margin: 0 auto;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.badge {
  color: #fff;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 15px;
}
.close {
  border: 0;
  background: #eef0f4;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}
.sheet-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 18px; font-weight: 700; }
.open-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  padding: 14px;
  border-radius: 14px;
}
