/* Limit goals: cap accounts per territory; Auto-Balance brings every capped book under the limit */

.bbi-lg-still,
.bbi-lg-still * { transition: none !important; }

.bbi-lg-goal .bbi-card__head,
.bbi-lg-tree .bbi-card__head { padding: 14px 18px 10px; }

.bbi-lg-board .bbi-card__head { height: 54px; padding: 14px 16px 0 18px; }

/* ---- The limit goal ---- */

.bbi-lg-goal .bbi-tag { margin-left: auto; }

.bbi-lg-opts { padding: 0 18px; }

.bbi-lg-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 46px;
  border-top: 1px solid var(--bbi-line);
  font-size: 13px;
  font-weight: 600;
  color: var(--bbi-muted);
}

.bbi-lg-max { display: inline-flex; align-items: baseline; gap: 7px; }

.bbi-lg-max b {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--bbi-ink);
  font-variant-numeric: tabular-nums;
}

.bbi-lg-max span { font-size: 13px; font-weight: 700; color: var(--bbi-muted); }

.bbi-lg-scope {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px 0 9px;
  border-radius: 9px;
  background: #fff3ea;
  font-size: 13px;
  font-weight: 800;
  color: #d9530a;
  transition: box-shadow 0.35s ease;
}

.bbi-lg-scope svg { width: 14px; height: 14px; }
.bbi-lg-scope small { font-size: 12px; font-weight: 700; color: #b78466; }

.bbi-lg-scope.is-lit,
.bbi-lg-crumb.is-lit { box-shadow: 0 0 0 3px rgba(252, 95, 8, 0.18); }

/* ---- Territory model ---- */

.bbi-lg-tbody {
  position: relative;
  height: 90px;
  margin: 0 14px;
}

.bbi-lg-tbody .bbi-links path { stroke-width: 2; }

.bbi-lg-tnode {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--bbi-line);
  box-shadow: var(--bbi-shadow-sm);
  transition: box-shadow 0.35s ease;
}

.bbi-lg-tnode svg { width: 14px; height: 14px; flex: none; }

.bbi-lg-tnode b {
  display: block;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--bbi-ink);
  white-space: nowrap;
}

.bbi-lg-tnode small {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.bbi-lg-tnode small svg { width: 12px; height: 12px; }

.bbi-lg-tnode--root {
  left: 50%;
  top: 0;
  height: 30px;
  transform: translateX(-50%);
  color: var(--bbi-muted);
}

.bbi-lg-tnode--cap,
.bbi-lg-tnode--ent { top: 46px; width: 136px; height: 44px; }

.bbi-lg-tnode--cap { left: 4px; border-color: #ffd0b0; background: #fff8f3; }
.bbi-lg-tnode--cap small { color: #d9530a; }
.bbi-lg-tnode--cap.is-lit { box-shadow: 0 0 0 3px rgba(252, 95, 8, 0.18), var(--bbi-shadow-sm); }

.bbi-lg-tnode--ent { right: 4px; }
.bbi-lg-tnode--ent small { color: var(--bbi-indigo); }

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

.bbi-lg-crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  margin-left: 2px;
  padding: 0 10px 0 8px;
  border-radius: 8px;
  background: #fff3ea;
  font-size: 12px;
  font-weight: 800;
  color: #d9530a;
  transition: box-shadow 0.35s ease;
}

.bbi-lg-crumb svg { width: 13px; height: 13px; }

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

.bbi-lg-go {
  margin-left: auto;
  height: 36px;
  padding: 0 16px;
  gap: 7px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  transition: background 0.35s ease, box-shadow 0.35s ease, transform 0.2s var(--bbi-ease);
}

.bbi-lg-go svg { width: 15px; height: 15px; }

.bbi-lg-go.is-busy {
  background-image: linear-gradient(100deg, #5e72e4 0%, #825ee4 40%, #b9a6f5 50%, #825ee4 60%, #5e72e4 100%);
  background-size: 250% 100%;
}

.bbi-lg-go.is-success { background: var(--bbi-grad-good); box-shadow: 0 12px 22px -10px rgba(26, 174, 111, 0.6); }

.bbi-lg-grid {
  position: relative;
  display: grid;
  align-items: center;
}

.bbi-lg-th {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--bbi-muted);
  white-space: nowrap;
}

.bbi-lg-th small { font-size: 11px; font-weight: 700; letter-spacing: 0; text-transform: none; color: #a3aec4; }
.bbi-lg-th--span { grid-column: span 2; }

.bbi-lg-terr {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bbi-lg-terr .bbi-avatar { width: 30px; height: 30px; }

.bbi-lg-terr b {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--bbi-ink);
  white-space: nowrap;
}

.bbi-lg-terr .bbi-pill { height: 18px; padding: 0 7px; font-size: 11px; }

.bbi-lg-terr small {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--bbi-muted);
  white-space: nowrap;
}

/* Horizontal account bars */
.bbi-lg-track {
  position: relative;
  height: 16px;
  border-radius: 999px;
  background: var(--bbi-surface-2);
  box-shadow: inset 0 0 0 1px var(--bbi-line);
}

.bbi-lg-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--bbi-grad-good);
  transition: background 0.35s ease;
}

.bbi-lg-fill.is-over { background: linear-gradient(90deg, #ff6f98, #f0386b); }

/* The part of a book past the cap */
.bbi-lg-over {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 0 999px 999px 0;
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.42) 0 4px, transparent 4px 8px);
}

.bbi-lg-overlabel {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  font-size: 12px;
  font-weight: 800;
  color: var(--bbi-bad);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.25s ease;
}

.bbi-lg-count,
.bbi-lg-arr {
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--bbi-surface-2);
  font-weight: 800;
  color: var(--bbi-muted);
  font-variant-numeric: tabular-nums;
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

.bbi-lg-count { height: 32px; font-size: 15px; }
.bbi-lg-arr { height: 36px; font-size: 15px; }

.bbi-lg-count.is-good,
.bbi-lg-arr.is-good { background: var(--bbi-good-bg); border-color: var(--bbi-good-edge); color: var(--bbi-good); }

.bbi-lg-count.is-bad,
.bbi-lg-arr.is-bad { background: var(--bbi-bad-bg); border-color: var(--bbi-bad-edge); color: var(--bbi-bad); }

.bbi-lg-count.is-pop,
.bbi-lg-arr.is-pop { animation: bbi-pop 0.5s var(--bbi-spring); }

/* Cap line */
.bbi-lg-cap {
  position: absolute;
  width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.bbi-lg-cap__badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--bbi-navy-deep);
  box-shadow: 0 6px 12px -6px rgba(30, 42, 74, 0.6);
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

.bbi-lg-cap__ok {
  display: none;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: -4px;
  border-radius: 50%;
  background: #fff;
  color: var(--bbi-good);
}

.bbi-lg-cap__ok svg { width: 10px; height: 10px; }

.bbi-lg-cap__line {
  flex: 1;
  width: 0;
  border-left: 2px dashed var(--bbi-navy-deep);
  opacity: 0.55;
  transition: border-color 0.4s ease, opacity 0.4s ease;
}

.bbi-lg-cap.is-met .bbi-lg-cap__badge { background: var(--bbi-good); box-shadow: 0 6px 14px -6px rgba(26, 174, 111, 0.7); }
.bbi-lg-cap.is-met .bbi-lg-cap__ok { display: grid; }
.bbi-lg-cap.is-met .bbi-lg-cap__line { border-color: var(--bbi-good); opacity: 0.9; }

/* Footer: total + result note */
.bbi-lg-foot {
  position: absolute;
  left: 18px;
  right: 16px;
  bottom: 12px;
  display: flex;
  align-items: center;
  height: 50px;
  padding-top: 8px;
  border-top: 1px solid var(--bbi-line);
}

.bbi-lg-total {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--bbi-muted);
}

.bbi-lg-total svg { width: 16px; height: 16px; }
.bbi-lg-total b { font-size: 14px; font-weight: 800; color: var(--bbi-ink); font-variant-numeric: tabular-nums; }

.bbi-lg-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  height: 42px;
  padding: 0 14px 0 6px;
  border-radius: 12px;
  background: #f2fbf7;
  border: 1px solid var(--bbi-good-edge);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity 0.35s ease, transform 0.55s var(--bbi-spring);
}

.bbi-lg-note.is-in { opacity: 1; transform: none; }

.bbi-lg-note__ok {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: var(--bbi-grad-good);
  color: #fff;
}

.bbi-lg-note__ok svg { width: 16px; height: 16px; }
.bbi-lg-note b { display: block; font-size: 14px; font-weight: 800; line-height: 1.2; color: var(--bbi-ink); }
.bbi-lg-note small { display: block; font-size: 12px; font-weight: 700; color: var(--bbi-good); }

/* Accounts in flight */
.bbi-lg-dot {
  position: absolute;
  z-index: 6;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--bbi-grad-brand);
  box-shadow: 0 0 0 2px #fff, 0 4px 8px -2px rgba(50, 50, 93, 0.45);
  pointer-events: none;
}
