:root {
  color-scheme: light;
  --ink: #16201d;
  --muted: #53635d;
  --panel: rgba(255, 255, 255, 0.93);
  --line: rgba(22, 32, 29, 0.16);
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --home: #f59e0b;
  --parcel: #138a72;
  --shadow: 0 8px 24px rgba(17, 24, 39, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#map {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
}

.topbar {
  position: fixed;
  z-index: 1000;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  pointer-events: none;
}

.brand {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.brand strong {
  font-size: 0.98rem;
  line-height: 1.1;
}

.brand span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  pointer-events: auto;
}

.icon-button svg {
  width: 21px;
  height: 21px;
  stroke-width: 2.2;
}

.icon-button.primary {
  border-color: rgba(15, 118, 110, 0.25);
  background: var(--panel);
  color: var(--accent);
}

.icon-button.primary.is-tracking {
  background: var(--accent);
  color: #fff;
}

.icon-button:active {
  transform: translateY(1px);
}

.status-panel {
  position: fixed;
  z-index: 1000;
  left: 12px;
  right: 72px;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  font-size: 0.9rem;
}

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.toggles label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.leaflet-control-attribution {
  font-size: 10px;
}

.owner-label {
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 1px 5px rgba(17, 24, 39, 0.22);
  color: #18221f;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  padding: 3px 5px;
  pointer-events: none;
  text-align: center;
  text-transform: uppercase;
}

.leaflet-tooltip.owner-label::before {
  display: none;
}

.user-dot {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.45), 0 6px 14px rgba(30, 64, 175, 0.25);
}

dialog {
  width: min(calc(100vw - 24px), 440px);
  max-height: min(72vh, 560px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(11, 18, 16, 0.28);
}

dialog h1 {
  margin: 0 48px 12px 0;
  font-size: 1.05rem;
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  box-shadow: none;
}

dl {
  display: grid;
  grid-template-columns: minmax(84px, 0.35fr) 1fr;
  gap: 8px 12px;
  margin: 0 0 14px;
  font-size: 0.9rem;
}

dt {
  color: var(--muted);
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.property-link {
  display: inline-flex;
  width: 100%;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
  text-decoration: none;
}

@media (min-width: 720px) {
  .topbar {
    right: 18px;
  }

  .status-panel {
    left: 18px;
    right: auto;
    width: 420px;
  }
}
