/* Mapping depth: presets, Smart Subdivide, guards, census overlay */

.bbi-gd-map .bbi-card__head { padding: 14px 14px 0 18px; white-space: nowrap; }
.bbi-gd-status { margin-left: 4px; }

.bbi-gd-balance {
  margin-left: auto;
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
}

.bbi-gd-balance svg { width: 16px; height: 16px; }

/* ---------- Cells ---------- */

.bbi-gd-hex,
.bbi-gd-zip {
  position: absolute;
  display: grid;
  place-items: center;
  align-content: center;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: #eef1f8;
  color: #a9b3cc;
  text-align: center;
  line-height: 1.1;
  transition: background-color 0.45s ease, color 0.45s ease, opacity 0.35s ease, transform 0.45s var(--bbi-spring);
}

.bbi-gd-hex b { font-size: 15px; font-weight: 800; }
.bbi-gd-hex small { margin-top: 2px; font-size: 12px; font-weight: 700; opacity: 0; transition: opacity 0.3s ease; }
.bbi-gd-hex.is-covered,
.bbi-gd-zip.is-covered { color: var(--bbi-ink); }
.bbi-gd-hex.is-covered small { opacity: 0.7; }
.bbi-gd-hex.is-dense { color: var(--bbi-bad); }
.bbi-gd-hex.is-dense small { opacity: 1; }
.bbi-gd-hex.is-split { opacity: 0; transform: scale(0.6); }

.bbi-gd-zip { z-index: 1; }
.bbi-gd-zip b { font-size: 11px; font-weight: 800; letter-spacing: -0.01em; }

.bbi-gd-hex.is-dark,
.bbi-gd-zip.is-dark { color: #fff; }
.bbi-gd-hex.is-dark small { opacity: 0.85; }

.bbi-gd-pop { animation: bbi-gd-pop 0.5s var(--bbi-spring); }

@keyframes bbi-gd-pop {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ---------- Territory legend ---------- */

.bbi-gd-legend {
  position: absolute;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.bbi-gd-terr {
  padding: 10px 12px 12px;
  border-radius: 14px;
  background: var(--bbi-surface-2);
  opacity: 0.55;
  transition: opacity 0.4s ease;
}

.bbi-gd-terr.is-on { opacity: 1; }

.bbi-gd-terr__name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--bbi-muted);
}

.bbi-gd-terr__name i { width: 10px; height: 10px; border-radius: 3px; }

.bbi-gd-terr__num {
  display: block;
  margin: 2px 0 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--bbi-muted);
}

.bbi-gd-terr__num b {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--bbi-ink);
  font-variant-numeric: tabular-nums;
}

.bbi-gd-terr .bbi-bar { height: 7px; }

/* ---------- Side panel ---------- */

.bbi-gd-panel { padding: 2px 0; }

.bbi-gd-sec {
  padding: 11px 16px 12px;
  transition: opacity 0.35s ease;
}

.bbi-gd-sec + .bbi-gd-sec { border-top: 1px solid var(--bbi-line); }
.bbi-gd-panel.is-guided .bbi-gd-sec:not(.is-current) { opacity: 0.45; }

.bbi-gd-sec__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 14px;
  font-weight: 800;
  color: var(--bbi-ink);
}

.bbi-gd-sec__head small {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--bbi-muted);
}

.bbi-gd-sec__icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 7px;
  background: rgba(94, 114, 228, 0.12);
  color: var(--bbi-indigo);
}

.bbi-gd-sec__icon svg { width: 14px; height: 14px; }

.bbi-gd-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.bbi-gd-chip {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #dfe4f2;
  font-size: 12px;
  font-weight: 700;
  color: var(--bbi-ink);
  white-space: nowrap;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.bbi-gd-chip--more { border-style: dashed; color: var(--bbi-muted); }
.bbi-gd-chip.is-pressed { transform: scale(0.94); }

.bbi-gd-chip.is-active {
  background: var(--bbi-grad-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 16px -8px rgba(94, 114, 228, 0.8);
}

.bbi-gd-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--bbi-muted);
}

.bbi-gd-sub b { color: var(--bbi-ink); font-weight: 800; }

.bbi-gd-sub__go {
  margin-left: auto;
  height: 34px;
  padding: 0 12px;
  gap: 6px;
  font-size: 13px;
}

.bbi-gd-sub__go svg { width: 14px; height: 14px; }

.bbi-gd-result {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--bbi-good-bg);
  color: var(--bbi-good);
  font-size: 12px;
  font-weight: 800;
}

.bbi-gd-result svg { width: 12px; height: 12px; }

.bbi-gd-guards { display: grid; gap: 6px; }

.bbi-gd-guard {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 30px;
  padding: 0 10px 0 6px;
  border-radius: 10px;
  background: var(--bbi-surface-2);
  font-size: 13px;
  font-weight: 700;
  color: var(--bbi-ink);
  white-space: nowrap;
  transition: background-color 0.3s ease;
}


.bbi-gd-guard i {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  background: #e3e7f1;
  color: #fff;
  transition: background-color 0.3s ease;
}

.bbi-gd-guard i svg { width: 11px; height: 11px; opacity: 0; transition: opacity 0.3s ease; }
.bbi-gd-guard.is-on { background: #f1fbf6; }
.bbi-gd-guard.is-on i { background: var(--bbi-good); }
.bbi-gd-guard.is-on i svg { opacity: 1; }

.bbi-gd-overlay {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bbi-gd-select {
  display: flex;
  flex: none;
  width: 116px;
  gap: 6px;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #dfe4f2;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  color: var(--bbi-muted);
  transition: border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.bbi-gd-select svg { width: 14px; height: 14px; margin-left: auto; }
.bbi-gd-select.is-pressed { transform: scale(0.97); }

.bbi-gd-select.is-active {
  border-color: rgba(94, 114, 228, 0.5);
  color: var(--bbi-ink);
  box-shadow: 0 0 0 3px rgba(94, 114, 228, 0.12);
}

.bbi-gd-scale {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--bbi-muted);
  opacity: 0.5;
  transition: opacity 0.35s ease;
}

.bbi-gd-scale i {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, #3f4d86 10%, #fff), #3f4d86);
}

.bbi-gd-sec.is-live .bbi-gd-scale { opacity: 1; }
