/* ── ORGANOGRAMA DINÂMICO (TALENTOS UI) ── */
.organograma-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 28px;
  overflow: auto;
  min-height: 550px;
  position: relative;
  box-shadow: var(--shadow-card);
}

.organograma-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.tree-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: max-content;
  padding: 20px 0;
}

/* NÓS DA ÁRVORE */
.tree-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 16px;
  position: relative;
}

.node-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  min-width: 240px;
  max-width: 280px;
  box-shadow: var(--shadow-card);
  transition: all 0.15s ease;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.node-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--brand-primary);
}

.node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.node-sigla-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  color: white;
}

.node-count-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.node-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.3;
}

.node-leader {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  margin-top: 6px;
}

.leader-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
}

.leader-info {
  overflow: hidden;
}

.leader-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leader-role {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* BOTÃO TOGGLE */
.node-toggle-btn {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  margin-top: -11px;
  z-index: 3;
  transition: all 0.15s ease;
}

.node-toggle-btn:hover {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

/* LINHAS CONECTORAS */
.tree-children {
  display: flex;
  justify-content: center;
  position: relative;
  padding-top: 24px;
  margin-top: 12px;
}

.tree-children::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 24px;
  background-color: #cbd5e1;
  transform: translateX(-50%);
}

.tree-node::before {
  content: '';
  position: absolute;
  top: -24px;
  left: 50%;
  width: 2px;
  height: 24px;
  background-color: #cbd5e1;
  transform: translateX(-50%);
}

/* Nós Raiz não têm linha superior apontando para o vazio */
#tree-root-container > div > .tree-node::before {
  display: none !important;
}

.tree-children > .tree-node:first-child::after {
  content: '';
  position: absolute;
  top: -24px;
  left: 50%;
  right: 0;
  height: 2px;
  background-color: #cbd5e1;
}

.tree-children > .tree-node:last-child::after {
  content: '';
  position: absolute;
  top: -24px;
  right: 50%;
  left: 0;
  height: 2px;
  background-color: #cbd5e1;
}

.tree-children > .tree-node:not(:first-child):not(:last-child)::after {
  content: '';
  position: absolute;
  top: -24px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: #cbd5e1;
}

.tree-children > .tree-node:only-child::after {
  display: none;
}
