/* Geo polygon: lasso ZIP codes with the Polygon tool and assign them to a territory */

.bbi-gp-map .bbi-card__head { padding: 14px 16px 0 18px; }
.bbi-gp-board .bbi-card__head { padding: 12px 16px 0 18px; }

.bbi-gp-status { margin-left: 4px; }

.bbi-gp-status.is-sel {
  gap: 7px;
  padding: 0 11px 0 4px;
  background: #1e2a4a;
  color: #fff;
}

.bbi-gp-status.is-sel b {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
}

.bbi-gp-undo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  height: 30px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--bbi-line);
  font-size: 12px;
  font-weight: 800;
  color: var(--bbi-muted);
  opacity: 0.5;
  transition: opacity 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.bbi-gp-undo svg { width: 14px; height: 14px; }
.bbi-gp-undo.is-ready { opacity: 1; color: var(--bbi-indigo); border-color: rgba(94, 114, 228, 0.4); }

/* ---------- Map ---------- */

.bbi-gp-svg { position: absolute; }
.bbi-gp-canvas .bbi-map__area { stroke-width: 0.6; }

.bbi-gp-canvas .bbi-map__area.is-sel {
  stroke: #1e2a4a;
  stroke-width: 1.6;
  filter: brightness(1.14);
}

.bbi-gp-canvas .bbi-map__area.is-new { animation: bbi-gp-new 0.9s ease-out; }

@keyframes bbi-gp-new {
  0% { filter: brightness(1.45) drop-shadow(0 0 4px rgba(255, 255, 255, 0.9)); }
  100% { filter: brightness(1); }
}

.bbi-gp-shape {
  fill: rgba(130, 94, 228, 0.16);
  stroke: none;
  transition: fill 0.4s ease;
}

.bbi-gp-edges,
.bbi-gp-rubber,
.bbi-gp-draw.is-closed .bbi-gp-shape {
  fill: none;
  stroke: #1e2a4a;
  stroke-width: 2.2;
  stroke-dasharray: 7 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.bbi-gp-rubber { stroke: rgba(30, 42, 74, 0.6); }

.bbi-gp-draw.is-closed .bbi-gp-shape {
  fill: rgba(255, 255, 255, 0.2);
  animation: bbi-gp-flash 0.7s ease-out, bbi-gp-march 1.2s linear infinite;
}

.bbi-gp-draw.is-closed .bbi-gp-edges,
.bbi-gp-draw.is-closed .bbi-gp-rubber { display: none; }

.bbi-gp-draw { transition: opacity 0.5s ease; }
.bbi-gp-draw.is-gone { opacity: 0; }

@keyframes bbi-gp-flash {
  0% { fill: rgba(130, 94, 228, 0.45); }
  100% { fill: rgba(255, 255, 255, 0.2); }
}

@keyframes bbi-gp-march { to { stroke-dashoffset: -24; } }

.bbi-gp-dot {
  fill: #fff;
  stroke: #1e2a4a;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.25s var(--bbi-spring), fill 0.25s ease;
}

.bbi-gp-dot.is-on { opacity: 1; animation: bbi-gp-dot 0.4s var(--bbi-spring); }
.bbi-gp-dot.is-target { transform: scale(1.6); fill: #825ee4; }

@keyframes bbi-gp-dot {
  from { transform: scale(0.2); }
  to { transform: scale(1); }
}

/* Toolbar */
.bbi-gp-tools {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 36px;
  padding: 0 4px;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--bbi-shadow-sm);
}

.bbi-gp-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
  color: #525f7f;
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.bbi-gp-tool svg { width: 15px; height: 15px; flex: none; }
.bbi-gp-sep { width: 1px; height: 20px; margin: 0 3px; background: var(--bbi-line); }
.bbi-gp-poly { padding: 0 9px 0 7px; }
.bbi-gp-poly.is-hover { background: rgba(94, 114, 228, 0.1); color: var(--bbi-indigo); }

.bbi-gp-poly.is-on {
  background: var(--bbi-grad-brand);
  color: #fff;
  box-shadow: 0 6px 12px -6px rgba(94, 114, 228, 0.7);
}

.bbi-gp-tip {
  position: absolute;
  left: 60px;
  top: 52px;
  z-index: 3;
  padding: 6px 10px;
  border-radius: 8px;
  background: #1e2a4a;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.bbi-gp-tip::before {
  content: '';
  position: absolute;
  left: 60px;
  top: -4px;
  width: 8px;
  height: 8px;
  background: #1e2a4a;
  transform: rotate(45deg);
}

.bbi-gp-legend {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 1;
  width: 150px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--bbi-shadow-sm);
}

.bbi-gp-legend__title {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bbi-muted);
}

.bbi-gp-legend__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--bbi-ink);
}

.bbi-gp-legend__row i { width: 11px; height: 11px; border-radius: 50%; flex: none; }

/* ---------- Selection panel ---------- */

.bbi-gp-panel { padding: 12px; z-index: 9; }

.bbi-gp-panel__head {
  padding: 0 2px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--bbi-muted);
}

.bbi-gp-panel__head b { color: var(--bbi-indigo); font-weight: 800; }

.bbi-gp-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  margin-bottom: 4px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--bbi-line);
  font-size: 12px;
  font-weight: 600;
  color: #a3acc7;
}

.bbi-gp-filter svg { width: 12px; height: 12px; }

.bbi-gp-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--bbi-ink);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.bbi-gp-opt i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.bbi-gp-opt b { font-weight: 800; }
.bbi-gp-opt small { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--bbi-muted); }
.bbi-gp-opt.is-current { opacity: 0.45; }
.bbi-gp-opt.is-hover { background: rgba(17, 167, 196, 0.12); }
.bbi-gp-opt.is-picked { box-shadow: inset 0 0 0 1.5px rgba(17, 167, 196, 0.55); }

.bbi-gp-opt__check {
  display: grid;
  place-items: center;
  width: 0;
  height: 16px;
  border-radius: 50%;
  background: #11a7c4;
  color: #fff;
  overflow: hidden;
  transition: width 0.3s var(--bbi-spring);
}

.bbi-gp-opt__check svg { width: 10px; height: 10px; flex: none; }
.bbi-gp-opt.is-picked .bbi-gp-opt__check { width: 16px; }

.bbi-gp-assign {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--bbi-line);
}

.bbi-gp-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--bbi-ink);
}

.bbi-gp-check__box {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1.5px solid #c5cde3;
  background: #fff;
}

.bbi-gp-go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  background: #e9ecf5;
  font-size: 12px;
  font-weight: 800;
  color: #a3acc7;
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.15s ease;
}

.bbi-gp-go svg { width: 12px; height: 12px; }

.bbi-gp-go.is-ready {
  background: var(--bbi-grad-brand);
  color: #fff;
  box-shadow: 0 8px 16px -8px rgba(94, 114, 228, 0.8);
}

.bbi-gp-go.is-pressed { transform: scale(0.94); }

.bbi-gp-actions {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.bbi-gp-actions span {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 26px;
  padding: 0 5px;
  border-radius: 7px;
  border: 1px solid var(--bbi-line);
  font-size: 11px;
  font-weight: 700;
  color: #525f7f;
  white-space: nowrap;
}

.bbi-gp-actions svg { width: 11px; height: 11px; flex: none; }
.bbi-gp-actions span:last-child { color: var(--bbi-bad); }

/* ---------- BoogieBoard ---------- */

.bbi-gp-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bbi-surface-2);
  font-size: 11px;
  font-weight: 800;
  color: var(--bbi-muted);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.bbi-gp-live i { width: 7px; height: 7px; border-radius: 50%; background: #c5cde3; }
.bbi-gp-live.is-on { background: #e9f8f1; color: #0d7347; }
.bbi-gp-live.is-on i { background: var(--bbi-good); animation: bbi-gp-blink 1s ease-in-out infinite; }

@keyframes bbi-gp-blink { 50% { opacity: 0.3; } }

.bbi-gp-pill { margin-left: auto; }

.bbi-gp-grid {
  display: grid;
  grid-template-columns: 200px 1fr 1fr;
  gap: 5px 10px;
  padding: 4px 18px 10px;
}

.bbi-gp-grid .bbi-pivot__head { height: 18px; }
.bbi-gp-grid .bbi-territory { height: 32px; gap: 10px; }
.bbi-gp-grid .bbi-territory .bbi-avatar { width: 28px; height: 28px; flex: none; }

.bbi-gp-grid .bbi-territory__name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.bbi-gp-grid .bbi-territory__name i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.bbi-gp-grid .bbi-territory__owner { font-size: 11px; line-height: 1.25; }
.bbi-gp-grid .bbi-cell { height: 32px; padding: 0 6px 0 14px; font-size: 15px; }

.bbi-gp-proj {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  animation: bbi-pop 0.4s var(--bbi-spring);
}

.bbi-gp-proj svg { width: 11px; height: 11px; }
.bbi-gp-proj.is-gain { background: #1aae6f; }
.bbi-gp-proj.is-loss { background: #e5484d; }
