.intro-card,
.layer-panel,
.map-controls {
  position: absolute;
  z-index: 10;
  background: var(--paper);
  border: 1px solid rgba(24, 50, 43, 0.11);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.intro-card {
  top: 20px;
  left: 20px;
  width: min(360px, calc(100% - 40px));
  border-radius: 18px;
}

.floating-card {
  overflow: hidden;
}

.floating-card.is-positioned {
  right: auto;
  bottom: auto;
}

.floating-card.is-dragging {
  z-index: 16;
  user-select: none;
}

.card-toolbar {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 4px;
  border-bottom: 1px solid var(--line);
}

.card-drag-handle {
  display: inline-flex;
  flex: 1;
  align-items: center;
  align-self: stretch;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  color: #52685f;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: grab;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  touch-action: none;
  user-select: none;
}

.card-drag-handle:active,
.floating-card.is-dragging .card-drag-handle {
  cursor: grabbing;
}

.card-drag-handle:hover,
.card-drag-handle:focus-visible,
.card-collapse:hover,
.card-collapse:focus-visible,
.layers-close:hover,
.layers-close:focus-visible {
  background: #eef2ed;
  outline: none;
}

.drag-grip {
  color: #809189;
  font-size: 20px;
  line-height: 1;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.card-collapse,
.layers-close {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
}

.layers-close {
  display: none;
}

.card-body {
  padding: 14px 18px 18px;
}

.card-body[hidden] {
  display: none;
}

.floating-card.is-collapsed {
  width: 210px;
}

.floating-card.is-collapsed .card-toolbar {
  border-bottom-color: transparent;
}

.map-kicker,
.layer-heading p {
  margin: 0;
  color: #688077;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.map-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
}

.map-kicker i {
  width: 7px;
  height: 7px;
  background: #36a875;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(54, 168, 117, 0.13);
}

.intro-card h1 {
  margin: 11px 0 12px;
  font-size: clamp(34px, 4vw, 51px);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.intro-card .card-body > p:not(.map-kicker) {
  margin: 0;
  color: #536a62;
  font-size: 13px;
  line-height: 1.55;
}

.source-pill {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin-top: 18px;
  padding: 12px 13px;
  background: #f0f4ef;
  border-radius: 11px;
}

.source-pill span,
.source-pill small {
  color: #6d8079;
  font-size: 10px;
}

.source-pill strong {
  justify-self: end;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.source-pill small {
  grid-column: 1 / -1;
}

.layer-panel {
  top: 20px;
  right: 20px;
  width: 310px;
  border-radius: 18px;
}

.layer-heading {
  margin-bottom: 14px;
}

.layer-heading h2 {
  margin: 3px 0 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.base-layer,
.layer-toggle {
  display: grid;
  grid-template-columns: 30px 1fr 28px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 8px 7px;
  text-align: left;
}

.base-layer {
  margin-bottom: 4px;
  background: #f4f6f2;
  border-radius: 11px;
}

.layer-toggle {
  background: transparent;
  border: 0;
  border-radius: 11px;
  cursor: not-allowed;
  opacity: 0.62;
}

.layer-toggle:disabled {
  color: #809089;
}

.base-layer strong,
.base-layer small,
.layer-toggle strong,
.layer-toggle small {
  display: block;
}

.base-layer strong,
.layer-toggle strong {
  font-size: 13px;
}

.base-layer small,
.layer-toggle small {
  margin-top: 2px;
  color: #788a83;
  font-size: 10px;
}

.layer-swatch {
  width: 26px;
  height: 26px;
  background: currentColor;
  border: 7px solid color-mix(in srgb, currentColor 22%, white);
  border-radius: 8px;
}

.layer-swatch.base {
  color: #65736e;
  background: repeating-linear-gradient(135deg, #65736e 0 2px, transparent 2px 5px);
}

.layer-toggle.sales { color: var(--sales); }
.layer-toggle.security { color: var(--security); }
.layer-toggle.cleaning { color: var(--cleaning); }
.layer-toggle.operations { color: var(--operations); }

.layer-toggle strong,
.layer-toggle small {
  color: var(--ink);
}

.base-layer > i,
.layer-toggle > i {
  position: relative;
  width: 26px;
  height: 16px;
  background: #dce4df;
  border-radius: 999px;
  font-size: 10px;
  font-style: normal;
}

.base-layer > i {
  display: grid;
  place-items: center;
  height: 26px;
  color: #fff;
  background: var(--ink);
}

.layer-toggle > i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  content: "";
  transition: translate 160ms ease;
}

.layer-note {
  margin: 13px 3px 0;
  padding-top: 12px;
  color: #75877f;
  border-top: 1px solid var(--line);
  font-size: 10px;
  line-height: 1.45;
}

.map-controls {
  right: 20px;
  bottom: 44px;
  display: grid;
  width: 48px;
  overflow: hidden;
  border-radius: 13px;
}

.map-controls button,
.map-controls output {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.map-controls button {
  cursor: pointer;
  font-size: 23px;
}

.map-controls button:hover,
.map-controls button:focus-visible {
  background: #eef2ed;
  outline: none;
}

.map-controls .fit-control {
  font-size: 18px;
}

.map-controls output {
  height: 31px;
  color: #71837c;
  border: 0;
  font-size: 9px;
  font-weight: 750;
}

.map-help,
.map-credit {
  position: absolute;
  z-index: 8;
  bottom: 8px;
  margin: 0;
  padding: 5px 8px;
  color: #71817b;
  background: rgba(250, 252, 249, 0.82);
  border-radius: 6px;
  font-size: 9px;
  backdrop-filter: blur(8px);
}

.map-help { left: 10px; }
.map-credit { right: 10px; }
.map-credit a { color: #405c52; }

.map-loading {
  position: absolute;
  z-index: 18;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  color: #62766e;
  background: #edf1ed;
  font-size: 12px;
  font-weight: 700;
  transition: opacity 280ms ease;
}

.map-loading span {
  width: 30px;
  height: 30px;
  margin: auto;
  border: 3px solid #d7e0da;
  border-top-color: #3c7761;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.map-loading.is-ready {
  opacity: 0;
  pointer-events: none;
}

@keyframes spin { to { rotate: 1turn; } }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 800px) {
  .map-app { grid-template-rows: 60px 1fr; }
  .app-bar { gap: 12px; padding: 0 12px; }
  .brand-mark { width: 35px; height: 35px; }
  .brand small { display: none; }
  .app-nav { display: none; }
  .layers-open { display: inline-flex; }
  .intro-card { top: 12px; left: 12px; width: min(310px, calc(100% - 24px)); }
  .intro-card h1 { margin: 8px 0; font-size: 34px; }
  .intro-card .card-body > p:not(.map-kicker) { font-size: 11px; line-height: 1.45; }
  .source-pill { margin-top: 12px; }
  .layer-panel {
    position: absolute;
    top: 12px;
    right: 12px;
    bottom: auto;
    width: min(310px, calc(100% - 24px));
    max-height: calc(100% - 20px);
  }
  .layer-panel:not(.is-open) { display: none; }
  .layer-panel.is-open { display: block; }
  .layer-panel .card-body { max-height: calc(100vh - 185px); overflow: auto; }
  .layers-close { display: grid; }
  .layer-list { display: grid; grid-template-columns: 1fr 1fr; }
  .map-controls { right: 12px; bottom: 48px; }
  .map-help { display: none; }
  .map-credit { right: auto; left: 8px; max-width: calc(100% - 76px); }
}

@media (max-width: 480px) {
  .layer-list { grid-template-columns: 1fr; }
  .layer-note { font-size: 9px; }
  .intro-card { max-width: 285px; }
}

@media (any-pointer: coarse) {
  .card-drag-handle,
  .card-collapse,
  .layers-close,
  .layers-open,
  .map-controls button {
    min-width: 48px;
    min-height: 48px;
  }

  .base-layer,
  .layer-toggle {
    min-height: 60px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
