/* Binary Tree — genealogy view */

.bt-page {
  max-width: none;
  width: 100%;
}

.bt-intro {
  margin-bottom: 1.05rem;
}

.bt-crumb {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.bt-crumb a:hover { color: var(--brand); }

.bt-crumb i,
.bt-crumb svg {
  width: 13px !important;
  height: 13px !important;
  opacity: 0.5;
}

.bt-crumb strong {
  color: var(--ink-soft);
  font-weight: 600;
}

.bt-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid color-mix(in srgb, var(--brand) 20%, #fff);
}

.bt-kicker i,
.bt-kicker svg {
  width: 13px !important;
  height: 13px !important;
}

.bt-intro .page-title {
  margin: 0 0 0.25rem;
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.bt-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Search */
.bt-search {
  padding: 1rem 1.15rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.04);
  margin-bottom: 1rem;
}

.bt-search > label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.bt-search__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
}

.bt-input {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 50px;
  padding: 0.15rem 0.85rem;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.bt-input:focus-within {
  background: #fff;
  border-color: color-mix(in srgb, var(--brand) 45%, #e5e7eb);
  box-shadow: 0 0 0 4px rgba(0, 166, 126, 0.1);
}

.bt-input__lead {
  width: 16px !important;
  height: 16px !important;
  color: #9ca3af;
}

.bt-input input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  font-family: "Poppins", sans-serif !important;
}

.bt-show {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 50px;
  padding: 0.65rem 1.15rem;
  border: 0;
  border-radius: 12px;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand-mid), var(--brand-deep));
  box-shadow: 0 10px 22px rgba(0, 166, 126, 0.25);
  white-space: nowrap;
}

.bt-show:hover {
  transform: translateY(-1px);
}

.bt-show i,
.bt-show svg {
  width: 15px !important;
  height: 15px !important;
}

/* Summary */
.bt-summary {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.bt-leg {
  padding: 1.1rem 1.15rem;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.04);
}

.bt-leg--left {
  border-top: 3px solid #64748b;
}

.bt-leg--right {
  border-top: 3px solid var(--brand);
}

.bt-leg__tag {
  display: inline-flex;
  margin-bottom: 0.85rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bt-leg--left .bt-leg__tag {
  color: #475569;
  background: #f1f5f9;
}

.bt-leg--right .bt-leg__tag {
  color: var(--brand-deep);
  background: var(--brand-soft);
}

.bt-leg__item {
  padding: 0.65rem 0;
  border-bottom: 1px dashed #e5e7eb;
}

.bt-leg__item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.bt-leg__item small {
  display: block;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.bt-leg__item strong {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.bt-center {
  min-width: 180px;
  padding: 1.25rem 1.2rem;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(ellipse 80% 70% at 50% 0%, rgba(16, 185, 129, 0.16), transparent 60%),
    #fff;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
  box-shadow: 0 14px 32px rgba(0, 166, 126, 0.1);
}

.bt-avatar {
  width: 78px;
  height: 78px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  margin-bottom: 0.75rem;
  color: #fff;
  background: linear-gradient(145deg, var(--brand-mid), var(--brand-deep));
  box-shadow: 0 12px 24px rgba(0, 166, 126, 0.28);
}

.bt-avatar i,
.bt-avatar svg {
  width: 34px !important;
  height: 34px !important;
}

.bt-id {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.bt-status {
  display: inline-flex;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.bt-status--red {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.bt-status--green {
  color: var(--brand-deep);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 20%, #fff);
}

/* Tree */
.bt-tree {
  padding: 1.5rem 1.2rem 1.6rem;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.06);
  text-align: center;
}

.bt-tree__root {
  display: flex;
  justify-content: center;
}

.bt-tree__lines {
  position: relative;
  height: 48px;
  margin: 0.25rem auto 0;
  max-width: 420px;
}

.bt-tree__vline {
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 24px;
  background: #cbd5e1;
  transform: translateX(-50%);
}

.bt-tree__hline {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 24px;
  height: 2px;
  background: #cbd5e1;
}

.bt-tree__hline::before,
.bt-tree__hline::after {
  content: "";
  position: absolute;
  top: 0;
  width: 2px;
  height: 24px;
  background: #cbd5e1;
}

.bt-tree__hline::before { left: 0; }
.bt-tree__hline::after { right: 0; }

.bt-tree__children {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 520px;
  margin: 0 auto;
}

.bt-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.95rem 0.85rem;
  border-radius: 16px;
  background: #f9fafb;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  font-family: "Poppins", sans-serif !important;
}

.bt-node:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.08);
  border-color: color-mix(in srgb, var(--brand) 30%, var(--line));
}

.bt-node--active {
  background: linear-gradient(180deg, #e8f8f2, #f9fafb);
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
}

.bt-node__avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--brand-mid), var(--brand-deep));
  margin-bottom: 0.2rem;
}

.bt-node__avatar.is-empty {
  background: #e5e7eb;
  color: #6b7280;
}

.bt-node__avatar i,
.bt-node__avatar svg {
  width: 22px !important;
  height: 22px !important;
}

.bt-node strong {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.bt-node small {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.bt-node__state.is-red {
  color: #b91c1c;
}

.bt-node__state.is-green {
  color: var(--brand);
}

@media (max-width: 991.98px) {
  .bt-summary {
    grid-template-columns: 1fr;
  }

  .bt-center {
    order: -1;
  }
}

@media (max-width: 575.98px) {
  .bt-search__row {
    grid-template-columns: 1fr;
  }

  .bt-tree__children {
    gap: 0.85rem;
  }
}
