:root { --sheet: 240px; --green: #0b7a53; --ink: #1a1d21; --muted: #667085; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); }
body.map-app { overflow: hidden; background: #d5ddd8; }
#app { height: 100dvh; position: relative; }
#map { position: absolute; inset: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.topbar {
  position: absolute; z-index: 500; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 22px;
  background: linear-gradient(#10211b, #10211b00);
  color: #fff;
}
.brand { font-weight: 800; letter-spacing: 0.04em; font-size: 15px; }
.brand b { font-weight: 600; letter-spacing: 0; opacity: 0.85; }
.pill {
  background: #ffffffd6; color: var(--green); border-radius: 999px;
  padding: 6px 10px; font-weight: 700; font-size: 13px;
}
#locate, #power {
  border: 0; border-radius: 999px; font-weight: 700;
}
#locate {
  position: absolute; z-index: 650; right: 14px;
  bottom: calc(var(--sheet) + 14px);
  width: 46px; height: 46px; font-size: 22px;
  background: #fff; box-shadow: 0 6px 18px #0002;
}
#pin {
  position: absolute; z-index: 550; left: 50%;
  top: calc(50% - var(--sheet) / 2);
  width: 28px; height: 28px; margin: 0;
  transform: translate(-50%, -100%);
  pointer-events: none;
}
#pin span {
  display: block; width: 28px; height: 28px; border-radius: 50% 50% 50% 0;
  background: var(--green); border: 3px solid #fff;
  transform: rotate(-45deg); box-shadow: 0 8px 16px #0004;
}
#pin span::after {
  content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%;
  background: #fff; top: 7px; left: 7px;
}
#sheet, #panel {
  position: absolute; z-index: 600; left: 50%; bottom: 0;
  transform: translateX(-50%); width: min(480px, 100%);
  background: #fff; border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 30px #0002;
  padding: 6px 16px calc(14px + env(safe-area-inset-bottom));
  max-height: 62dvh; overflow: auto;
}
.grabber { width: 36px; height: 4px; border-radius: 4px; background: #d8dee3; margin: 6px auto 10px; }
.muted { color: var(--muted); font-size: 13px; }
.title { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.price { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; }
.addr { padding: 8px 0; border-bottom: 1px solid #f0f2f4; }
.addr b, .kicker { display: block; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.addr span { font-size: 16px; }
.addr.tap { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid #f0f2f4; padding: 8px 0; }
.btn {
  width: 100%; height: 52px; border: 0; border-radius: 14px;
  font-size: 17px; font-weight: 700; margin-top: 10px;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:disabled { background: #b7c9c2; }
.btn.ghost { background: #eef3f0; color: var(--green); }
.btn.danger { background: #fff; color: #c5362b; }
a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
#sheet a:not(.btn), #panel a:not(.btn), .login a { color: var(--green); font-weight: 700; }
.leaflet-bottom { margin-bottom: calc(var(--sheet) + 4px); }
.leaflet-right .leaflet-control-attribution { margin-right: 62px !important; }
#reg { height: 100%; overflow: auto; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.links { display: flex; gap: 14px; margin-top: 8px; }
.links a, .textlink { color: var(--green); font-weight: 700; font-size: 14px; background: none; border: 0; padding: 0; }
.field { width: 100%; height: 48px; border: 1px solid #e1e6ea; border-radius: 12px; padding: 0 12px; background: #f7f8f8; margin-top: 8px; }
.live-row { display: flex; gap: 8px; align-items: center; color: var(--green); font-weight: 700; font-size: 14px; }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px #0b7a5300; } }
.driver { display: flex; gap: 12px; align-items: center; margin: 8px 0; }
.swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid #0002; flex: none; }
.plate {
  display: inline-flex; align-items: center; border: 2px solid var(--ink);
  border-radius: 7px; font-weight: 800; letter-spacing: 0.04em; overflow: hidden;
}
.plate i { background: #1d4ed8; color: #fff; font-style: normal; font-size: 10px; padding: 6px 5px; }
.plate b { padding: 4px 8px; }
.stack { display: flex; flex-direction: column; }
#search {
  position: absolute; inset: 0; z-index: 800; background: #fff;
  display: flex; flex-direction: column; padding-top: env(safe-area-inset-top);
}
.search-bar { display: flex; gap: 8px; padding: 10px 12px; }
#search-back { width: 42px; height: 42px; border: 0; border-radius: 12px; background: #f2f4f5; font-size: 20px; }
#search-input { flex: 1; height: 42px; border: 0; background: #f2f4f5; border-radius: 12px; padding: 0 12px; font-size: 16px; }
.chips { display: flex; gap: 8px; overflow: auto; padding: 0 12px 8px; }
.chips button { border: 1px solid #e1e6ea; background: #f6f8f7; border-radius: 999px; padding: 8px 12px; white-space: nowrap; }
.result { width: 100%; text-align: left; background: #fff; border: 0; border-bottom: 1px solid #f0f2f4; padding: 14px 16px; }
.result b { display: block; }
.result span { color: var(--muted); font-size: 13px; }
#dialog {
  position: absolute; inset: 0; z-index: 900; background: #0006;
  display: flex; align-items: flex-end; justify-content: center;
}
.dialog-card {
  width: min(480px, 100%); background: #fff; border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
}
#toast {
  position: absolute; z-index: 950; left: 50%; bottom: calc(var(--sheet) + 12px);
  transform: translateX(-50%); background: var(--ink); color: #fff;
  border-radius: 12px; padding: 10px 14px; max-width: min(420px, 92%); font-size: 14px;
}
.leaflet-top { top: 64px; }
.leaflet-control-attribution { font-size: 10px; }

#cab { height: 100%; }
#who { display: flex; flex-direction: column; gap: 2px; }
#who .name { font-weight: 800; }
#power { height: 40px; padding: 0 14px; background: #fff; color: var(--ink); }
#power.on { background: var(--green); color: #fff; }
.warn { background: #fff6e8; color: #92400e; border-radius: 12px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }

body.desk { background: #f3f5f4; height: auto; overflow: auto; }
body.desk #app { height: auto; min-height: 100%; max-width: 760px; margin: 0 auto; padding: 16px 14px 40px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.stat { background: #fff; border-radius: 16px; padding: 12px; }
.stat b { display: block; font-size: 22px; }
.card { background: #fff; border-radius: 16px; padding: 12px 14px; margin-top: 10px; }
.badge { font-size: 12px; font-weight: 800; }
.share b { display: block; word-break: break-all; margin-bottom: 8px; }
.login { max-width: 420px; margin: 12vh auto 0; background: #fff; border-radius: 20px; padding: 20px; }
@media (min-width: 800px) {
  #sheet, #panel { bottom: 12px; border-radius: 22px; }
}
