:root {
  --bg: #0b0c10;
  --card: #111317;
  --muted: #8b919e;
  --text: #e9eef5;
  --accent: #12b886; /* verde GPS */
  --stroke: #21242b;
}

* { box-sizing: border-box; }
html, body, .app { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--stroke);
  background: #0c0e13;
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 600; letter-spacing: 0.2px; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.actions { display: flex; gap: 8px; }
.btn {
  background: var(--accent);
  color: #02140f;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--stroke);
}

.panel {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 12px;
  height: calc(100% - 57px);
  padding: 12px;
}
@media (max-width: 920px) {
  .panel { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
}

.info {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 16px;
}
.info h2 { margin: 4px 0 12px; font-size: 16px; color: #d6dbe6; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px dashed #1b1e24; }
.kv:last-child { border-bottom: none; }
.k { color: var(--muted); }
.v { color: var(--text); font-weight: 600; }
.hint { margin-top: 12px; color: var(--muted); font-size: 12px; }

.ref-panel {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
  display: grid; gap: 6px;
}
.ref-panel img {
  width: 100%; height: auto; display: block; border-radius: 8px; border: 1px solid var(--stroke);
  background: #0e1117;
}
.ref-caption { color: var(--muted); font-size: 12px; }

.map-wrap {
  position: relative;
  background: #0e1117;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  overflow: hidden;
}
#map { width: 100%; height: 100%; min-height: 480px; }

.center-marker {
  position: absolute; inset: 0; pointer-events: none;
  display: grid; place-items: center;
}
.center-marker .gps { position: absolute; }
.center-marker .device { position: absolute; transform: translateY(-2px); }

.pulse {
  position: absolute;
  width: 120px; height: 120px;
  border: 2px solid rgba(18,184,134,0.35);
  border-radius: 50%;
  animation: pulse 2.8s ease-out infinite;
}
.pulse-2 { animation-delay: 1.2s; }
@keyframes pulse {
  from { transform: scale(0.6); opacity: 0.6; }
  to   { transform: scale(1.5); opacity: 0; }
}

.status {
  position: absolute; left: 12px; bottom: 12px;
  background: rgba(12,14,19,0.8);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(6px);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: #cfd6e6;
}

/* Leaflet UI tweaks for dark theme */
.leaflet-control-attribution,
.leaflet-control-scale {
  background: rgba(20,24,30,0.8) !important;
  color: #cfd6e6 !important;
  border: 1px solid var(--stroke) !important;
  border-radius: 6px !important;
}
.leaflet-control-zoom a {
  background: rgba(20,24,30,0.9) !important;
  color: #cfd6e6 !important;
  border: 1px solid var(--stroke) !important;
}