/* ===== TÍTULO CENTRALIZADO ===== */
.titulo-familiar {
  text-align: center;
  margin-top: 30px;
}

/* ===== SISTEMA DE ABAS / TABS EXECUTIVAS CENTRALIZADAS (PADRÃO PATRIMÔNIO) ===== */
.container_tabs_familiar {
  max-width: 960px;
  margin: 30px auto 40px auto;
  width: 100%;
}

.tabs-nav-familiar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f4f4f5;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid #e4e4e7;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab-btn-familiar {
  flex: 1;
  min-width: 160px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  background: transparent;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Outfit', sans-serif;
  user-select: none;
  text-align: center;
}

.tab-btn-familiar:hover {
  background: rgba(255, 255, 255, 0.65);
}

.tab-btn-familiar.active {
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.tab-btn-familiar .tab-btn-titulo {
  font-size: 13.5px;
  font-weight: 600;
  color: #52525b;
  transition: color 0.2s ease;
}

.tab-btn-familiar.active .tab-btn-titulo {
  color: #09090b;
  font-weight: 700;
}

/* Painéis de Conteúdo das Abas */
.tab-pane-familiar {
  display: none;
}

.tab-pane-familiar.active {
  display: block;
  animation: tabFadeIn 0.22s ease-out;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-card-container {
  background: white;
  padding: 36px 36px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tab-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid rgba(0, 0, 0, 0.06);
  flex-wrap: wrap;
  gap: 12px;
}

.tab-card-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #09090b;
  margin: 0;
  letter-spacing: -0.3px;
}

.tab-pane-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #f4f4f5;
  gap: 12px;
}

.btn-tab-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  border: 1px solid #e4e4e7;
  background: #ffffff;
  color: #09090b;
  text-decoration: none !important;
}

.btn-tab-nav:hover {
  background: #f4f4f5;
  border-color: #d4d4d8;
}

.btn-tab-nav.primary {
  background: #09090b;
  color: #ffffff !important;
  border-color: #09090b;
}

.btn-tab-nav.primary:hover {
  background: #27272a;
}

@media (max-width: 768px) {
  .container_tabs_familiar {
    padding: 0 14px;
    margin: 20px auto;
  }
  .tab-card-container {
    padding: 24px 18px;
  }
  .tab-btn-familiar {
    min-width: 140px;
    padding: 8px 10px;
  }
}

.container_familia {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 35px;
  max-width: 100%;
  width: 100%;
  margin: 40px auto;
  padding: 0 25px;
}

/* ===== BLOCO (CARD) ===== */
.bloco {
  background: white;
  padding: 35px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bloco h2 {
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1.5px solid rgba(0, 0, 0, 0.08);
}

/* ÁREAS DINÂMICAS */
#area_filhos, #dados_casamento, #dados_pais, #dados_colaterais, #sucessao_conjuge {
  background: #fafafa;
  padding: 20px;
  border-radius: 12px;
  margin-top: 10px;
  border: 1px dashed rgba(0, 0, 0, 0.15);
}

#sucessao_conjuge h4 {
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

#idades_filhos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-top: 15px;
}

/* ===== RESPONSIVIDADE MOBILE ===== */
@media (max-width: 768px) {
  .container_familia {
    grid-template-columns: 1fr;
    padding: 0 14px;
    gap: 20px;
    margin: 20px auto;
  }

  .bloco {
    padding: 22px 16px;
  }

  #idades_filhos {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .container_familia {
    padding: 0 10px;
  }

  .bloco h2 {
    font-size: 18px;
    margin-bottom: 15px;
  }
}

/* ===================================================
   ORGANOGRAMA E MAPEAMENTO SUCESSÓRIO FAMILIAR
   =================================================== */

.organograma-section {
  background: #ffffff;
  padding: 38px 42px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.08);
  margin: 15px 25px 40px 25px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.organograma-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.organograma-title-box h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 8px 0 6px 0;
  color: #09090b;
}

.organograma-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  max-width: 620px;
  line-height: 1.5;
}

.organograma-badge-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.live-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  animation: pulseLive 2s infinite;
}

@keyframes pulseLive {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Métricas Rápidas (Legítima vs Parcela Disponível) */
.organograma-metricas-rapidas {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.metrica-card-sucessoria {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 18px;
  min-width: 145px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.metrica-card-sucessoria.destaque-legitima {
  border-left: 4px solid #09090b;
}

.metrica-card-sucessoria.destaque-disponivel {
  border-left: 4px solid #0ea5e9;
}

.metrica-card-sucessoria.destaque-meacao {
  border-left: 4px solid #10b981;
}

.metrica-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.metrica-card-val {
  font-size: 16px;
  font-weight: 700;
  color: #09090b;
}

.metrica-card-desc {
  font-size: 11px;
  color: #64748b;
}

/* ── ÁRVORE VISUAL (CANVAS) ── */
.tree-canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 20px 0 10px 0;
  overflow-x: auto;
  max-width: 100%;
}

.tree-level {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
}

/* Nível Casal */
.tree-couple-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  position: relative;
}

.tree-marriage-bridge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}

.tree-marriage-line {
  width: 44px;
  height: 2px;
  background: #cbd5e1;
}

.tree-marriage-tag {
  background: #09090b;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 100px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Cards Individuais dos Membros (Nós) */
.tree-node-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px 20px;
  min-width: 200px;
  max-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
  transition: all 0.25s ease;
  position: relative;
  text-align: center;
}

.tree-node-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.tree-node-card.node-titular {
  border-color: #09090b;
  background: linear-gradient(to bottom, #ffffff, #fafafa);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
}

.tree-node-card.node-conjuge {
  border-color: #3b82f6;
  background: linear-gradient(to bottom, #ffffff, #f0f9ff);
}

.tree-node-card.node-filho {
  border-color: #e2e8f0;
  min-width: 175px;
  max-width: 210px;
}

.tree-node-card.node-filho.menor-idade {
  border-color: #f59e0b;
  background: #fffbeb;
}

.tree-node-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  margin: 0 auto 2px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #0f172a;
}

.node-titular .tree-node-avatar {
  background: #09090b;
  color: #ffffff;
}

.node-conjuge .tree-node-avatar {
  background: #dbeafe;
  color: #1d4ed8;
}

.node-filho .tree-node-avatar {
  background: #f1f5f9;
  color: #475569;
}

.node-filho.menor-idade .tree-node-avatar {
  background: #fef3c7;
  color: #b45309;
}

.tree-node-name {
  font-size: 14px;
  font-weight: 700;
  color: #09090b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-node-role {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.tree-node-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 4px;
}

.badge-legitima {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #cbd5e1;
}

.badge-meacao {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-menor {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Conectores da Árvore */
.tree-connector-down {
  width: 2px;
  height: 36px;
  background: #cbd5e1;
  margin: 0 auto;
}

.tree-children-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.tree-children-branch-line {
  height: 2px;
  background: #cbd5e1;
  margin-bottom: 20px;
}

.tree-children-list {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}

/* ── ALERTAS DE RISCO SUCESSÓRIO ── */
.alertas-sucessorios-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.alerta-sucessorio-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.alerta-sucessorio-item.alerta-aviso {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.alerta-sucessorio-item.alerta-info {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
}

.alerta-sucessorio-item.alerta-oportunidade {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
}

.alerta-sucessorio-item i,
.alerta-sucessorio-item svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.alerta-sucessorio-item strong {
  font-weight: 700;
}

@media (max-width: 860px) {
  .organograma-section {
    padding: 24px 16px;
    margin: 15px 12px 30px 12px;
  }

  .organograma-header {
    flex-direction: column;
  }

  .tree-couple-wrapper {
    flex-direction: column;
    gap: 14px;
  }

  .tree-marriage-line {
    width: 2px;
    height: 20px;
  }
}

/* ===== AÇÕES E BOTÃO TOGGLE DO ORGANOGRAMA ===== */
.familiar-acoes {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 40px auto 60px auto;
  flex-wrap: wrap;
}

.familiar-acoes .btn-prev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #ffffff;
  color: #18181b !important;
  border: 1.5px solid #e4e4e7;
  padding: 15px 32px;
  border-radius: 100px;
  text-decoration: none !important;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
  user-select: none;
}

.familiar-acoes .btn-prev:hover {
  transform: translateY(-2px);
  background: #f4f4f5;
  border-color: #a1a1aa;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  color: #09090b !important;
}

.familiar-acoes .btn-prev:active {
  transform: translateY(0);
}

.familiar-acoes .btn-prev i,
.familiar-acoes .btn-prev svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.familiar-acoes .btn-prev:hover i,
.familiar-acoes .btn-prev:hover svg {
  transform: translateX(-4px);
}

.btn-toggle-organograma {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #ffffff;
  color: #18181b;
  border: 1.5px solid #e4e4e7;
  padding: 15px 32px;
  border-radius: 100px;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
  user-select: none;
}

.btn-toggle-organograma:hover {
  transform: translateY(-2px);
  background: #f4f4f5;
  border-color: #a1a1aa;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.btn-toggle-organograma:active {
  transform: translateY(0);
}

.btn-toggle-organograma.ativo {
  background: #f8fafc;
  border-color: #09090b;
  color: #09090b;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.btn-toggle-organograma .btn-toggle-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-toggle-organograma.ativo .btn-toggle-icon {
  transform: rotate(180deg);
}

.btn-toggle-organograma i,
.btn-toggle-organograma svg {
  width: 18px;
  height: 18px;
}

/* Animação suave de abertura */
.organograma-section {
  animation: fadeInDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}